learn by doing

Startup scripts in Ubuntu and Debian based Linux distributions

Here are 2 simple steps which help you to run a script when your Ubuntu machine boots:

  1. Edit your script and add it in /etc/init.d/
  2. Run update-rc.d script which creates a link to your script on each of the runlevels  with a set priority.
root@virtual:/etc/init.d# update-rc.d defaults 85
update-rc.d: warning: /etc/init.d/ missing LSB information
update-rc.d: see <
 Adding system startup for /etc/init.d/ ...
   /etc/rc0.d/ -> ../init.d/
   /etc/rc1.d/ -> ../init.d/
   /etc/rc6.d/ -> ../init.d/
   /etc/rc2.d/ -> ../init.d/
   /etc/rc3.d/ -> ../init.d/
   /etc/rc4.d/ -> ../init.d/
   /etc/rc5.d/ -> ../init.d/