chkconfig

From Initq
Jump to: navigation, search


Contents

List the start scripts

  • chkconfig --list
  • chkconfig --list | grep proxy-forward

Enable a start script

  • chkconfig --level 345 proxy-forward on

Writing a start script

#!/bin/sh
#
# Apache proxy forward script
#
# Version 1.0 - Qais Chaudry 20110816
# qais.chaudry@atos.net
#
# chkconfig: 345 99 50
# description:	proxy-forward is used for forwarding all port 80 \
#		traffic to a loadbalancer at port 8080.
#
 
case "$1" in
	start)
/opt/httpd-2.2.19/bin/apachectl start
	;;
 
	stop)
 
		kill -9 `ps -ef|grep https|grep -v grep|awk '{print $2}'`
 
	;;
 
	*)
        echo $"Usage: $0 {start|stop}"
        exit 2
 
esac
 
exit 0

Enable your own start script

$ /sbin/chkconfig llc2 on

service llc2 does not support chkconfig

it look like chkconfig looks for a line similar to the following in each run control script:

  1. chkconfig: 345 99 50

The values after the “chkconfig:” statement contain the runlevels to enable the script at, the value to use after the “S” in the start scripts, and the value to use after the “K” in the kill scripts. So 345 would cause the start script to be executed at run levels 3, 4 and 5, the start script would be named S99llc2, and the kill script would be named K50llc2.

Personal tools