Tuesday, 9 November 2010

ubuntu startup scripts.

What a mess. Try this:

Copy the script into /etc/init.d

Edit it to include the following header:

#! /bin/sh
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO


Do:

$ sudo chmod +x scriptname

Run,

$ sudo update-rc.d scriptname defaults

`defaults' sets `scriptname' to run at runlevels 2,3,4,5
by creating links to the script in those levels; and
adds a link to the script to kill it at levels 0, 1, 6.

Remove the startup script via,

$ sudo update-rc.d -f scriptname remove

No comments:

Post a Comment