Working with Red Hat init Scripts

8:20 AM
To help handle your init scripts, Red Hat comes with the command chkconfig. The chkconfig
command works by reading two commented lines near the top of each of your init scripts.


Sample chkconfig Line in an init Script
# chkconfig: 2345 10 90
# description: Activates/Deactivates all network interfaces configured to \
# start at boot time.


You can see the first line in the script starts with chkconfig:, followed by three components.
The first component comprises the run levels at which a service should start. The second component
consists of the starting sequence number of the service, and the third component contains
the stopping sequence number of the service.


Listing init Scripts Using the chkconfig Command


puppy# chkconfig --list


kdcrotate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
courier-imap 0:off 1:off 2:on 3:on 4:on 5:on 6:off




To stop a service from starting, you can use the --del option.


puppy# chkconfig --del name


To add the service back to the boot sequence, you can use the --add option.


puppy# chkconfig --add name


secure the contents of this directory.


puppy# chown root:root /etc/rc.d/init.d/*
puppy# chmod -R 700 /etc/rc.d/init.d/*

0 Comments