DEV Community

Stack All Flow
Stack All Flow

Posted on • Originally published at stackallflow.com on

What’s the Difference Between “Service” and “/Etc/init.D/” in Ubuntu?

servicesupstart

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

Enter fullscreen mode Exit fullscreen mode

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/?

Accepted Answer

/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, so 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. In the future, when more and more scripts are transferred to upstart, service will still work because it finds both possibilities.

The post What’s the Difference Between “Service” and “/Etc/init.D/” in Ubuntu? appeared first on Stack All Flow.

Top comments (0)