Quick-and-dirty SYSV start script
# insert tags for dependency based boot here
name="FOO"
dir="/usr/local/$name"
pidfile="$dir/var/$name.pid"
case "$1" in
start)
echo "Starting $name "
$dir/sbin/$name
;;
stop)
echo "Shutting down $name "
kill `cat $pidfile`
#killall $name
;;
restart)
$0 stop
$0 start
;;
reload)
echo "HUPing $name"
kill -1 `cat $pidfile`
#killall -1 $name
;;
status)
echo "Checking for service $name "
ps aux|grep "$name"|grep -v status
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
Tags for Dependency Based Boot
Example for Debian >= 6.0
### BEGIN INIT INFO # Provides: name # Required-Start: $remote_fs $syslog $local_fs $network # Required-Stop: $remote_fs $syslog $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts name ### END INIT INFO
Example for Redhat, CentOS:
# chkconfig: 2345 20 80 # description: name
Managing rc Scripts
Redhat, CentOS, Mandriva: chkconfig
SuSE: inssrv
Debian: update-rc.d, since 6.0 (Squeeze) insserv
BSD: vi /etc/rc.conf (see /etc/defaults/rc.conf)
