‘service foo restart’ on Ubuntu 12.04 will “Do the right thing”

Just a quick note.. I was watching Artur Bergman’s rant about Full Stack awareness at Velocity Europe with glee, until I saw how we, the Ubuntu devs, had drawn his ire for breaking something so simple, ‘restart’.

I’ve heard this before, and I realized that its true! Restart should ignore that the service is stopped, and just start it, otherwise just restart it as I requested.

So, first off, instead of:

/etc/init.d/apache2 restart

or (for upstart controlled services)

restart mysql

get in the habit of doing:

service apache2 restart

This command will do the right thing more often than not (including clearing out the environment for sysvinit jobs, which can help solve the “why does the service only work when I restart it manually”). And as of 12.04, it will start doing the right thing with restart too.

Its not perfect, and there are still bugs in upstart, but the version of ‘sysvinit’ that I just uploaded to Precise Pangolin (the future 12.04 / LTS release of Ubuntu) at least gives scripters and sysadmins a chance at uniformity by making upstart jobs and sysvinit scripts do the same thing with restart. I don’t think we can backport this all the way to 10.04, so sorry for that. However, please, users, keep the rants coming.. we need them!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>