3 # <service> <service> short service description
5 # chkconfig: 345 <start_level> <stop_level>
7 # description: <service> long service description
9 # processname: <procname>
14 # Source function library
15 . /etc/rc.d/init.d/functions
18 . /etc/sysconfig/network
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down "<service_name>"
36 # Get service config - may override defaults
37 [ -f /etc/sysconfig/<service> ] && . /etc/sysconfig/<service>
39 pidfile="/var/run/<service>.pid"
42 # must return non-zero if check failed
43 # output is discarded if checkconfig is ran without details
45 /usr/sbin/<service> -t
49 # wrapper for configtest
53 if [ $details = 1 ]; then
54 # run config test and display report (status action)
55 show "Checking %s configuration" "<service_name>"; busy
57 out=$(configtest 2>&1)
59 if [ $RETVAL = 0 ]; then
64 [ "$out" ] && echo >&2 "$out"
66 # run config test and abort with nice message if failed
67 # (for actions checking status before action).
68 configtest >/dev/null 2>&1
70 if [ $RETVAL != 0 ]; then
71 show "Checking %s configuration" "<service_name>"; fail
72 nls 'Configuration test failed. See details with %s "checkconfig"' $0
79 # Check if the service is already running?
80 if [ -f /var/lock/subsys/<service> ]; then
81 msg_already_running "<service_name>"
86 msg_starting "<service_name>"
87 daemon /usr/sbin/<service>
89 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/<service>
93 if [ ! -f /var/lock/subsys/<service> ]; then
94 msg_not_running "<service_name>"
99 msg_stopping "<service_name>"
101 killproc --pidfile $pidfile <procname> -TERM
102 rm -f /var/lock/subsys/<service>
106 if [ ! -f /var/lock/subsys/<service> ]; then
107 msg_not_running "<service_name>"
113 msg_reloading "<service_name>"
114 killproc <procname> -HUP
115 killproc --pidfile $pidfile <procname> -HUP
120 if [ ! -f /var/lock/subsys/<service> ]; then
121 msg_not_running "<service_name>"
132 # See how we were called.
148 # include force-reload here if program allows reloading without restart
149 # otherwise remove reload action and support force-reload as restart if running
153 # use this one if program doesn't support reloading without restart
157 checkconfig|configtest)
162 status --pidfile $pidfile <service>
163 status --pidfile $pidfile <service> <procname>
167 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"