Technology Inside Out!

Index ¦ Archives ¦ Atom ¦ RSS

Understanding init.d Directory In Linux Filesystem.

init.d is the sub-directory of /etc directory in Linux file system. init.d basically contains the bunch of start/stop scripts which are used to control (start,stop,reload,restart) the daemon while the system is running or during boot. If you look at /etc/init.d then you will notice all the scripts for different services of your system.

The scripts within the directory varies as per the applications installed in your system. In server system you'll find many network related scripts while in desktop there will be the only basic ones like 'networking'.

init_main_featureimage

There are two types of scripts :  K scripts & S scripts.

K scripts are known 'kill' scripts while S scripts are known as 'startup' scripts. Kill scripts always run before startup scripts. The configuration file (.conf) of these scripts are located under /etc/init & the scripts that are used as defaults are located under /etc/default.

Within /etc/init.d you'll find the script rc.local ,this script is automatically executed after all primarily priortized scripts are executed. Which means first K scripts are executed, following by S scripts, then all other remaining init level scripts (if there's any) & finally rc.local script.

init_pic2

init_pic3

Now to control any script, you'll need the superuser (sudo/su) permission. You can manually control the scripts using console/terminal. The syntax for controlling the script is like :

# /etc/init.d/<script> <option>

Where \<script>  stands for the name of the script located under /etc/init.d which you wanna control, and \<option> can be replaced by the control commands like : start,stop,reload,restart,force-reload.

Example :

sudo /etc/init.d/pulseaudio reload

I hope this helps to understand /etc/init.d directory. This was basic understanding of init.d directory, there's more into it which will be covered soon.

© The Geeky Way. Built using Pelican. Theme by Giulio Fidente on github.

Disclaimer Privacy policy