]> git.pld-linux.org Git - packages/cancd.git/blob - cancd.init
e81b7b6e96137562cb98108c7748644426491b15
[packages/cancd.git] / cancd.init
1 #!/bin/sh
2 #
3 # cancd netconsole daemon
4 #
5 # chkconfig:    2345 29 20
6 #
7 # description:  This is the CA NetConsole Daemon, \
8 #       a daemon to receive output from the Linux netconsole driver.
9 #
10 # $Id$
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Get service config - may override defaults
19 [ -f /etc/sysconfig/cancd ] && . /etc/sysconfig/cancd
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network ]; then
24                 msg_network_down cancd
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 start() {
32         # Check if the service is already running?
33         if [ ! -f /var/lock/subsys/cancd ]; then
34                 msg_starting cancd
35                 daemon --user "$USER" /usr/sbin/cancd -p ${CANCD_PORT} -l "${CRASH_DIR}" -o "${CRASH_FORMAT}"
36                 RETVAL=$?
37                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cancd
38         else
39                 msg_already_running cancd
40         fi
41 }
42
43 stop() {
44         if [ -f /var/lock/subsys/cancd ]; then
45                 # Stop daemons.
46                 msg_stopping cancd
47                 killproc cancd
48                 rm -f /var/lock/subsys/cancd
49         else
50                 msg_not_running cancd
51         fi
52 }
53
54 RETVAL=0
55 # See how we were called.
56 case "$1" in
57   start)
58         start
59         ;;
60   stop)
61         stop
62         ;;
63   restart|force-reload)
64         stop
65         start
66         ;;
67   status)
68         status cancd
69         RETVAL=$?
70         ;;
71   *)
72         msg_usage "$0 {start|stop|restart|force-reload|status}"
73         exit 3
74 esac
75
76 exit $RETVAL
This page took 0.035058 seconds and 2 git commands to generate.