Sysvinit

= Sysvinit =

Sysvinit is a widely used init system for Unix and Linux. It reads the file /etc/inittab and uses the information in it to start processes, daemons, and login prompts based on the current runlevel. If for some reason a daemon is killed, it can be respawned.

Like any traditional Unix program, sysvinit does one thing and does it very well. It launches and runs shell scripts. The scripts use Unix utilities to carry out all the configuration tasks associated with startup, including the launching of various daemons.

/etc/inittab tells init to run startup scripts contained in /etc/rc.d and /etc/init.d. The scripts in /etc/init.d are mainly to start or stop daemons, but some are one-off configuration scripts. The files in /etc/rc.d/rc*.d (where * is a runlevel number) are symbolic links to those scripts, named in a way that tells /etc/rc.d/rc whether to start or stop the process when moving to level *. Start links have names beginning with S while stop or kill links have names beginning with K. This initial letter is followed by a 2-digit sorting number, which ensures that scripts are run in the correct order.

By convention runlevel 0 is shutdown, 1 is single-user and 6 is reboot. Intermediate numbers may be used in a distro-specific manner.