/[smeserver]/rpms/mdadm/sme7/mdmonitor.init
ViewVC logotype

Annotation of /rpms/mdadm/sme7/mdmonitor.init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Jun 12 16:34:41 2007 UTC (17 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: mdadm-1_12_0-2_el4_sme
Import on branch sme7 of package mdadm-1.12.0-2.el4.sme.src.rpm

1 slords 1.1 #!/bin/bash
2     #
3     # mdmonitor This starts, stops, and reloads the mdadm-based
4     # software RAID monitoring and management facility
5     #
6     # chkconfig: 2345 15 85
7     # description: software RAID monitoring and management
8     # config: /etc/mdadm.conf
9     #
10    
11     # Copyright 2002 Red Hat, Inc.
12    
13     PATH=/sbin:/usr/sbin:$PATH
14     RETVAL=0
15    
16     prog=mdmonitor
17    
18     # Source function library.
19     . /etc/rc.d/init.d/functions
20    
21     # Make sure configuration file exists and has information we can use
22     # MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
23     [ -f /etc/mdadm.conf ] || exit 0
24     grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || exit 0
25    
26    
27     usage ()
28     {
29     echo "Usage: service $prog {start|stop|status|restart|condrestart}"
30     RETVAL=1
31     }
32    
33    
34     start ()
35     {
36     ulimit -S -c 0 >/dev/null 2>&1
37     echo -n $"Starting $prog: "
38     daemon --check mdadm \
39     "/bin/bash -c \"mdadm --monitor --scan -f > /var/run/mdadm/mdadm.pid\""
40     # hack: wait for mdadm to die, assume success if it doesn't die quickly
41     usleep 100000
42     if [ -s /var/run/mdadm/mdadm.pid -a -d /proc/$(cat /var/run/mdadm/mdadm.pid) ] ; then
43     success $"mdadm"
44     RETVAL=0
45     touch /var/lock/subsys/$prog
46     else
47     failure $"mdadm"
48     rm -f /var/run/mdadm/mdadm.pid
49     rm -f /var/lock/subsys/$prog
50     RETVAL=1
51     fi
52     echo
53     }
54    
55     stop ()
56     {
57     echo -n "Killing $prog: "
58     killproc mdadm
59     echo
60     rm -f /var/run/mdadm/mdadm.pid
61     rm -f /var/lock/subsys/$prog
62     }
63    
64     restart ()
65     {
66     stop
67     start
68     }
69    
70     condrestart ()
71     {
72     [ -e /var/lock/subsys/$prog ] && restart
73     }
74    
75    
76     case "$1" in
77     start) start ;;
78     stop) stop ;;
79     status) status mdadm ;;
80     restart|reload) restart ;;
81     condrestart) condrestart ;;
82     *) usage ;;
83     esac
84    
85     exit $RETVAL

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed