RedHat init.d

From Noah.org
Jump to navigationJump to search


RedHat uses `chkconfig` to manage links between /etc/init.d and the /etc/rc.d runlevel directories. For example, the `atd` daemon is normally off in a default install. You can list the status or set `atd` to turn "on" automatically for certain runlevels.

chkconfig --list atd
chkconfig atd on

Chkconfig normally figures out what runlevels to start a command by looking for special comments in the header of the given /etc/init.d/ script. This is in the header of the /etc/init.d/atd script:

# chkconfig: 345 95 5
# description: Runs commands scheduled by the at command at the time \
#    specified when at was run, and runs batch commands when the load \
#    average is low enough.

That tells `chkconfig` that when turned "on" `atd` will be added to runlevels 3,4,5 with a start priority of 95 and a stop priority of 5. Chkconfig will create links from /etc/rc3.d/S95atd, /etc/rc4.d/S95atd, /etc/rc5.d/S95atd to ../init.d/atd.

Note that Ubuntu/Debian use `sysv-rc-conf` and `update-rc.d` for similar purposes.