Init-d Template
Create a new file
$ sudo vim /etc/init.d/$NAME
Change the template to suit your needs
#!/bin/bash
case "$1" in
start)
# start commands here
;;
stop)
# stop commands here
;;
restart)
# restart commands here
;;
*) # no parameter specified
echo "Usage: /etc/init.d/$NAME start|stop|restart"
exit 1
;;
esac
exit 0
Hook the script to all runlevels
$ sudo update-rc.d $NAME defaults
Comments Off