Understanding init.d Directory In LinuxFilesystem.
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’.
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 we can find the script rc.local ,this script is automatically executed after all primarily 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.
Now to control any script, you’ll need the superuser (sudo/su) permission. You can manually control the scripts using terminal.
The syntax for controlling the script is like :
# /etc/init.d/<script> <option>
EXAMPLE:
# sudo /etc/init.d/cron reload
S.no | Srcipt in init.d | Purpose |
1 | acpid | The acpid daemon supports the Advanced Configuration and Power Interface (ACPI) to allow intelligent power management on your system and to query battery and configuration status. |
2 | alsa-utils | The ALSA Utilities package contains various utilities which are useful for controlling your sound card. |
3 | Anacron | Similar to the cron service, the anacron service runs applications or scripts at specific times and dates.Unlike the cron service, anacron will not miss the execution of a scheduled job, even if the system is powered off. The activity will be performed when the system is next available. This makes anacron the preferred choice to initiate essential system administration tasks such as backup or disk space recovery. |
4 | apache2 | This script is used to control the apache server. |
5 | bluetooth | This script controll the bluetooth at the system startup |
6 | checkfs.sh | This script Checks all filesystems in the startup and log the message in fsck.log file. |
7 | Cron | It makes to run cron in the system startup. Cron will execute a sheduled command ath that given time. |
8 | Cups | Manage the CUPS Printing spooler and server; make it’s web interface accessible on http://localhost: |
9 | Grub-common | GRUB displays the boot menu at the next boot if it believes that the previous boot failed. This script informs it that the system booted successfully. |
10 | Isc-dhcp-server | It makes the DHCP(Dynamic Host Control Protocol) server to start. Which gives Dynamic ip address to the client. |
11 | Killprocs | Kill all the process before starting the init.d. |
12 | Lightdm | LightDM is the display manager running in Ubuntu up to version 16.04 LTS. While it has been replaced by GDM in later Ubuntu releases. The display manager will be started by this scripts. |
13 | mountall.sh | This script is used to mount all the file system listed in fstab. |
14 | mysql | This script is used to control the mysql server. |
15 | networking | It is used to start and configure neywork interface. |
16 | NetworkManager | If using DHCP, NetworkManager is intended to replace default routes, obtain IP addresses from a DHCP server and change nameservers whenever it sees fit. In effect, the goal of NetworkManager is to make networking Just Work.This script will controll Network manager. |
17 | Nfs-kernel-server | NFS is a popular protocol for file sharing across TCP/IP networks. This service provides NFS server functionality, which is configured via the /etc/exports file. |
18 | x11-common | It makes the X server (graphics) files to start in the system startup. |
19 | rc.local | It contains scripts to be used to control the starting, stopping and restarting of user defined daemons. |
20 | resolvconf | It is nameserver information manager. This service manages the list of nameserver addresses used by the libc resolver and name service caches |
21 | Rsync | It is fast remote file copy program daemon that allows files to be copied to and from remote machines in much the same way as rcp. This provides rsyncd daemon functionality. |
22 | rsyslog | It makes to store log message of rsync daemon at the system startup. |
23 | samba | Samba is linux server application and this script starts the samba.conf at the system startup. |
24 | Ufw | It is Ubuntu firewall. It makes the firewall to enable at the system startup. |
25 | umountfs | This script is used to unmount the hard disk that are assigned in the fstab. |