Add your own start up scripts to your ubuntu server

After a couple of unexpected server shutdowns we figured out that we had to automatically start certain jobs at boot time. In particular we had a server for our mercurial repository and a few paster servers that need to restart every time the machine was reboot.

Writing your own start up script is very easy. In its simplest form create a file in the /var/init.d directory and make sure that you change the permissions so that it is executable (chmod +x myStartupScript). Then just run:

sudo update-rc.d myStartupScript defaults

I'll show in a future blog how to add start / stop functionality to your script (hint, look into an existing script in /etc/init.d)

comments powered by Disqus