What's the difference between "Service" and "/etc/init.d/"?

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

  • How to enable or disable services?

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 :)