Ubuntu Startup
From charlesreid1
Startup Services
(Unfortunately, there is a seemingly endless number of ways to add a startup service to Ubuntu. One is using upstart, in /etc/init
, one is using /etc/rc.local
, and the last uses LSB init scripts. The last method is recommended.)
To add a program to the startup process of Ethane, follow this procedure:
First, create a script in /etc/init.d
with the name of your service (e.g., servicename):
sudo touch /etc/init.d/servicename
Next, edit the servicename script so it contains a header (following this format: http://wiki.debian.org/LSBInitScripts) along with any commands that need to be run:
### 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 put_your_commands_here
Last, add the servicename to the boot sequence:
sudo update-rc.d servicename defaults
You should see an output like this:
Adding system startup for /etc/init.d/svnserve ... /etc/rc0.d/K20svnserve -> ../init.d/svnserve /etc/rc1.d/K20svnserve -> ../init.d/svnserve /etc/rc6.d/K20svnserve -> ../init.d/svnserve /etc/rc2.d/S20svnserve -> ../init.d/svnserve /etc/rc3.d/S20svnserve -> ../init.d/svnserve /etc/rc4.d/S20svnserve -> ../init.d/svnserve /etc/rc5.d/S20svnserve -> ../init.d/svnserve