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've been managing server installations both on and off Ubuntu flavor for some time - I've become quite adjusted to /etc/init.d/ for restarting servcies. Now I get this message:

root@tatooine:~# /etc/init.d/mysql status
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql status

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the status(8) utility, e.g. status mysql
mysql start/running, process 14048

This seems to have been brought about in the latest LTS of Ubuntu - why? What's so bad about /etc/init.d/ and what/is there a difference between service and /etc/init.d/?

share|improve this question
The Upstart Cookbook contains a good explanation of the rational for switching. – ændrük Jun 8 '11 at 15:55
up vote 75 down vote accepted

/etc/init.d scripts are the old way of doing things. They come from the System V standard. However, those scripts are fired only in a particular sequence, no real dependencies can be established.

Therefore, upstart has been developed with the intent to substitute all the /etc/init.d scripts with upstart scripts (in /etc/init).

service allows the smooth transition from /etc/init.d scripts to upstart scripts. When in the future more on more scripts are transferred to upstart, service will still work, because it finds both possibilties.

share|improve this answer
Upstart is going to be phased out now, right? – wrongusername Mar 2 '14 at 15:11
systemd will replace upstart once plans are in place - 14.04 LTS will use upstart. This was announced by Mark Shuttleworth, in a post titled Losing graciously – RichardWigley Apr 6 '14 at 14:05

Also check the man page for the service command: man service

service runs a script in a predictable environment (working directory is / and only 2 environment variables are set: LANG and TERM). It also adds the ability to do --full-restart. So to sum up:

  1. service may run scripts from either /etc/init or /etc/init.d (upstart or System V)
  2. service runs scripts in a predictable environment.

The "predictable environment" aspect can cause you problems if your script depends on an environment variable for some reason. There is probably a way to get around that, but I don't know what it is, and that's beyond the scope of this question :)

share|improve this answer
Hi @Joe Marty, This is exactly the problem I'm experimenting now. I have a service that relays on a "DISPLAY" environment variable that is not present when starting the daemon with "service myservice start" but present when starting it with "/etc/init.d/myservice start". Any idea on how to have this variable available? – frandevel Feb 11 at 15:07

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.