Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently learning upstart by playing around. I think I have understood the principle now, but I am having difficulties with the "kill timeout" stanza in upstart jobs.

For example, I have the following job (filename /etc/init/test.conf):

description "test"
start on test
console owner
kill timeout 5
exec /root/test

The file /root/test is a small shell script which runs forever:

while true; do o=1; done;

When doing "initctl start test", the job "test" is run and calls the script "/root/test". I can verify that by doing "initctl status test" which shows the job as running as well as by doing "ps -Alf".

Now, the "kill timeout 5" stanza should cause the job to be killed after 5 seconds. But instead, the job seems to run forever.

I would like to know if I am using and understanding the kill timeout stanza in the right way. It is an essential feature for me.

This is on Natty 11.04, but I think the question applies to other versions as well.

Thank you very much,


share|improve this question
up vote 4 down vote accepted

That's not what kill timeout does; it specifies how long to wait after sending a polite "terminate" signal for the process to exit before giving up and launching nukes.

If you want to set a process time limit in the upstart way, the easiest way is probably to have something periodically issue a timer event, and use stop on timer. Alternately (and perhaps more generally), create a wrapper program which forks a small process which sends an event after a time period, and stop on that event.

For more information and best practices, see The Upstart Cookbook.

share|improve this answer
Thank you very much! Then I'll just make sure that none of my "custom" upstart jobs will run forever. – Binarus Mar 14 '11 at 19:10

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.