3 # <service> <service> short service description
5 # chkconfig: 345 <start_level> <stop_level>
7 # description: <service> long service description
9 # processname: <procname>
15 # Source function library
16 . /etc/rc.d/init.d/functions
19 . /etc/sysconfig/network
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down "<service_name>"
37 # Get service config - may override defaults
38 [ -f /etc/sysconfig/<service> ] && . /etc/sysconfig/<service>
40 pidfile="/var/run/<service>.pid"
43 # must return non-zero if check failed
44 # output is discarded if checkconfig is ran without details
46 /usr/sbin/<service> -t
50 # wrapper for configtest
54 if [ $details = 1 ]; then
55 # run config test and display report (status action)
56 show "Checking %s configuration" "<service_name>"; busy
58 out=$(configtest 2>&1)
60 if [ $RETVAL = 0 ]; then
65 [ "$out" ] && echo >&2 "$out"
67 # run config test and abort with nice message if failed
68 # (for actions checking status before action).
69 configtest >/dev/null 2>&1
71 if [ $RETVAL != 0 ]; then
72 show "Checking %s configuration" "<service_name>"; fail
73 nls 'Configuration test failed. See details with %s "checkconfig"' $0
80 # Check if the service is already running?
81 if [ -f /var/lock/subsys/<service> ]; then
82 msg_already_running "<service_name>"
87 msg_starting "<service_name>"
88 daemon /usr/sbin/<service>
90 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/<service>
94 if [ ! -f /var/lock/subsys/<service> ]; then
95 msg_not_running "<service_name>"
100 msg_stopping "<service_name>"
102 killproc --pidfile $pidfile <procname> -TERM
103 rm -f /var/lock/subsys/<service>
107 if [ ! -f /var/lock/subsys/<service> ]; then
108 msg_not_running "<service_name>"
114 msg_reloading "<service_name>"
115 killproc <procname> -HUP
116 killproc --pidfile $pidfile <procname> -HUP
121 if [ ! -f /var/lock/subsys/<service> ]; then
122 msg_not_running "<service_name>"
133 # See how we were called.
149 # include force-reload here if program allows reloading without restart
150 # otherwise remove reload action and support force-reload as restart if running
154 # use this one if program doesn't support reloading without restart
158 checkconfig|configtest)
163 status --pidfile $pidfile <service>
164 status --pidfile $pidfile <service> <procname>
168 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"