Init-d Template

May 28 2011

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

Comments are closed at this time.

Performance Optimization WordPress Plugins by W3 EDGE