1 #!/bin/sh 2 # 3 # APPLICATION_PACKAGE APPLICATION_DESCRIPTION 4 # 5 # chkconfig: 2345 20 80 6 # description: APPLICATION_DESCRIPTION 7 # 8 9 ### BEGIN INIT INFO 10 # Provides: 11 # Required-Start: 12 # Required-Stop: 13 # Should-Start: 14 # Should-Stop: 15 # Default-Start: 16 # Default-Stop: 17 # Short-Description: 18 # Description: 19 ### END INIT INFO 20 21 # Source function library. 22 . /etc/rc.d/init.d/functions 23 24 exec=/opt/APPLICATION_NAME/APPLICATION_LAUNCHER_FILENAME 25 prog=APPLICATION_LAUNCHER_FILENAME 26 27 lockfile=/var/lock/subsys/$prog 28 29 start() { 30 [ -x $exec ] || exit 5 31 echo -n $"Starting $prog: " 32 # trailing ampersand backgrounds the process 33 daemon $exec & 34 retval=$? 35 echo 36 [ $retval -eq 0 ] && touch $lockfile 37 return $retval 38 } 39 40 stop() { 41 echo -n $"Stopping $prog: " 42 killproc $prog 43 retval=$? 44 echo 45 [ $retval -eq 0 ] && rm -f $lockfile 46 return $retval 47 } 48 49 restart() { 50 stop 51 start 52 } 53 54 reload() { 55 restart 56 } 57 58 force_reload() { 59 restart 60 } 61 62 rh_status() { 63 # run checks to determine if the service is running or use generic status 64 status $prog 65 } 66 67 rh_status_q() { 68 rh_status >/dev/null 2>&1 69 } 70 71 72 case "$1" in 73 start) 74 rh_status_q && exit 0 75 $1 76 ;; 77 stop) 78 rh_status_q || exit 0 79 $1 80 ;; 81 restart) 82 $1 83 ;; 84 reload) 85 rh_status_q || exit 7 86 $1 87 ;; 88 force-reload) 89 force_reload 90 ;; 91 status) 92 rh_status 93 ;; 94 condrestart|try-restart) 95 rh_status_q || exit 0 96 restart 97 ;; 98 *) 99 echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 100 exit 2 101 esac 102 exit $?