three99

web development

Add Your Own Start Up Scripts to Your Ubuntu Server

| Comments

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:

1
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