Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a script that I would like to run as a service on my Ubuntu Server 11.04 headless box. That is, I want to have the correct files under /etc/init.d/ and to be able to control it via the service command.

Is there any guide available that will show me how to do this?

share|improve this question

2 Answers 2

up vote 10 down vote accepted

You will probably be better off if you turn your script into an Upstart job, rather than follow the examples you'll find in /etc/init.d/ (which are System V-style init scripts, which Ubuntu and other distributions are moving away from).

The Upstart Cookbook has an enormous amount of information about how Upstart jobs work. Although I wouldn't describe it as a HOWTO, if you combine the information there with looking through the stock Ubuntu Upstart jobs in /etc/init/ you will start to get the picture.

I suggest starting with section 4 and 5 of the Cookbook, "Concepts and Terminology" and "Configuration"

share|improve this answer

Here is a very simple example how to create an upstart script: https://wiki.frugalware.org/index.php/Upstart_Job_HOWTO

You should place the script in /etc/init/yourfilename.conf

Then reload the configuration with:

sudo initctl reload-configuration

And if all is OK, you should be able to start it with:

sudo start yourfilename
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.