]> git.pld-linux.org Git - packages/cpqarrayd.git/blob - cpqarrayd.init
58324e8b74f57f5649f88c25d059766a0ac1a690
[packages/cpqarrayd.git] / cpqarrayd.init
1 #!/bin/sh
2 #
3 # cpqarrayd    Start/Stop Compaq Array monitor
4 #
5 # chkconfig: 345 15 90
6 # description: The cpqarrayd monitors the status of Compaq Raid Arrays, \
7 #              and reports via syslog or traps
8 # processname: cpqarrayd
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 CPQ_PARAMS=""
14
15 # Get config.
16 if [ -f /etc/sysconfig/cpqarrayd ]; then
17         . /etc/sysconfig/cpqarrayd
18 fi
19
20 start() {
21         # Check if the service is already running?
22         if [ ! -f /var/lock/subsys/cpqarrayd ]; then
23                 msg_starting cpqarrayd
24                 for host in $TRAP_DESTINATIONS; do
25                         CPQ_PARAMS="$CPQ_PARAMS -t $host"
26                 done
27                 daemon cpqarrayd $CPQ_PARAMS
28                 RETVAL=$?
29                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cpqarrayd
30         else
31                 msg_already_running cpqarrayd
32         fi
33 }
34
35 stop() {
36         if [ -f /var/lock/subsys/cpqarrayd ]; then
37                 # Stop daemons.
38                 msg_stopping cpqarrayd
39                 killproc cpqarrayd
40                 rm -f /var/lock/subsys/cpqarrayd
41         else
42                 msg_not_running cpqarrayd
43         fi
44 }
45
46 condrestart() {
47         if [ -f /var/lock/subsys/cpqarrayd ]; then
48                 stop
49                 start
50         else
51                 if [ $1 -ne 0 ]; then
52                         msg_not_running cpqarrayd
53                 fi
54                 RETVAL=$1
55         fi
56 }
57
58 RETVAL=0
59 # See how we were called.
60 case "$1" in
61 start)
62         start
63         ;;
64 stop)
65         stop
66         ;;
67 restart)
68         stop
69         start
70         ;;
71 try-restart)
72         condrestart 0
73         ;;
74 force-reload)
75         condrestart 7
76         ;;
77 status)
78         status cpqarrayd
79         RETVAL=$?
80         ;;
81 *)
82         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
83         exit 3
84 esac
85
86 exit $RETVAL
This page took 0.066605 seconds and 3 git commands to generate.