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 normally use this command to restart my daemons(e.g. vsftpd):

$sudo /etc/init.d/vsftpd restart

Early today I noticed it said that I can try restart(8) utility. I did:

$sudo restart vsftpd

It worked. But when I tried to restart my apache2:

$sudo restart apache2
> restart: Unknown job: apache2

Why are they different? Of course I can restart apache2 by /etc/init.d/apache2

share|improve this question
up vote 8 down vote accepted

The commands start, stop, restart, etc., are links for initctl, and only work for upstart jobs.

Calling directly the script in /etc/init.d/ will give a warning for upstart jobs, for which the use of the script is allowed for convenience, through a wrapper symlinked common script.

Calling the service command always works, both for upstart jobs and for traditional sysv init scripts, so it is the preferred way.

share|improve this answer
And apache2 happens to be a script that is not converted (yet?) to an Upstart job. sudo start x tries to load /etc/init/x.conf. – Lekensteyn Jul 25 '11 at 17:53

You should be able to use service:

sudo service apache2 restart
share|improve this answer
@Lekensteyn: It is not the same (at least on 10.10), as restart will only refer to initctl, but service is more general and can be used both for upstart and System V init. – arrange Jul 25 '11 at 18:00
@arrange: confirmed in the source; it first checks for an upstart script in /etc/init/apache2.conf and if that cannot be executed, /etc/init.d/apache2 is tried. The manual page does not include that though. – Lekensteyn Jul 25 '11 at 20:21

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.