Saturday, August 14, 2010

Runlevel Service Management in Linux



  • We can indicate desired runlevels for each services in Linux
  • Services are located in: /etc/init.d

1. /usr/sbin/ntsysv: 


Usage: 
1. ntsysv - manages services in the current run-level 
2. ntsysv 35 - manages services for run-levels 3 & 5 

Note: ntsysv nor chkconfig starts|stops services

2. Chkconfig 


Usage
1. chkconfig --list ntpd - returns run-level environment for 'ntpd' 
Note: items listed as 'off' have K (kill) scripts Note: items listed as 'on' have S (start) scripts
2. chkconfig --level 3 ntpd off - creates a K(kill) script in run-level 3




3. chkconfig --level 35 ntpd off
4. chkconfig ntpd on - enables 'ntpd' in levels 2-5 
5. chkconfig ntpd off - disables 'ntpd' in levels 0-6 
Note: Use 'chkconfig' from the shell or a script
Note: Use 'ntsysv' from the shell in interactive mode
Note: When controlling services using 'chkconfig', reference the name of the service as it's specified in: /etc/init.d
system-config-services - GUI tool to manage services