O'Reilly logo

Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition by Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding init Scripts and the Final Stage of Initialization

Each /etc/init.d script, or init script, contains logic that determines what to do when receiving a start or stop value. The logic might be a simple switch statement for execution, as in this example:

case "$1" in  start)        start        ;;  stop)        stop        ;;  restart)        restart        ;;  reload)        reload         ;;  status)        rhstatus        ;;  condrestart)        [ -f /var/lock/subsys/smb ] && restart || :        ;;  *)        echo $"Usage: $0 {start|stop|restart|status|condrestart}"        exit 1esac

Although you can use the scripts to customize the way that the system runs from power-on, absent the replacement of the kernel, this script approach ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required