Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ubuntu 14.04 /etc/init.d/ vs /etc/init/ start service at startup

Tags:

From what I understood, the /etc/init.d directory contains the scripts executed by init at boot time. Is that only for Debian or for Ubuntu 14.04 as well?

I am wondering because I have several scripts in the init.d directory but they do not seem to be run when the server starts. Is there a log to check?

For example, when I installed supervisor (apt-get install supervisor), it created an init script in /etc/init.d/supervisor which is supposed to start it but when I start my server, supervisor does not run. I have some other examples so it does not seem to be related to the supervisor script only.

Also, what is the difference between /etc/init.d and etc/init ? I am confused.

Thanks

like image 912
Michael Avatar asked Oct 08 '14 21:10

Michael


1 Answers

The scripts in /etc/init.d/ are scripts that control services. Controlling means that they take care of starting, stopping and similar actions.

They are not automatically executed at startup. Instead, you must assign scripts to runlevels, which is done with the update-rc.d command on Debian-based systems (which Ubuntu is).

For example, to add your supervisor service to all default runlevels, you would execute

sudo update-rc.d supervisor defaults 

Also, you're asking for the difference between /etc/init.d and /etc/init:

  • /etc/init.d contains the service scripts,
  • /etc/init contains configuration for these scripts (descriptions. dependencies, post-/pre-actions). However IIRC, /etc/init is specific to SysV init.
like image 64
lxg Avatar answered Oct 21 '22 08:10

lxg