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

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

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


Revision 1.2 - (show annotations) (download)
Sat Dec 1 02:32:57 2007 UTC (16 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: mdadm-1_12_0-5_1_el4_sme, HEAD
Changes since 1.1: +42 -30 lines
Import on branch sme7 of package mdadm-1.12.0-5.1.el4.sme.src.rpm

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 # Copyright 2002 Red Hat, Inc.
11 #
12 ### BEGIN INIT INFO
13 # Default-Start: 2 3 4 5
14 # Default-Stop: 0 1 6
15 # Short-Description: Start and stop the MD software RAID monitor
16 # Description: The mdmonitor service checks the status of all software
17 # RAID arrays on the system. In the event that any of the arrays
18 # transition into a degraded state, it notifies the system
19 # administrator. Other options are available, see the mdadm.conf
20 # and mdadm man pages for possible ways to configure this service.
21 ### END INIT INFO
22
23 PIDFILE=/var/run/mdadm/mdadm.pid
24 PATH=/sbin:/usr/sbin:$PATH
25 RETVAL=0
26 OPTIONS="--monitor --scan -f --pid-file=$PIDFILE"
27
28 prog=mdmonitor
29
30 # Source function library.
31 . /etc/rc.d/init.d/functions
32
33
34 usage ()
35 {
36 echo "Usage: service $prog {start|stop|status|restart|try-restart|force-reload}"
37 RETVAL=1
38 }
39
40
41 start ()
42 {
43 # Check we are being started with root perms or exit as mdadm won't
44 # necessarily be able to open the devices it is supposed to monitor
45 # otherwise, and will also spew SELinux warnings about being in the /
46 # directory when spawning sendmail on a notification attempt
47 [ `id -u` -eq 0 ] || return 4
48 # Make sure configuration file exists and has information we can use
49 # MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
50 [ -f /etc/mdadm.conf ] || return 6
51 grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || return 6
52 [ -x /sbin/mdadm ] || return 1
53 if [ -f "$PIDFILE" ]; then
54 checkpid `cat $PIDFILE` && return 0
55 fi
56 echo -n $"Starting $prog: "
57 cd /
58 daemon --user=root mdadm ${OPTIONS}
59 ret=$?
60 [ $ret -eq "0" ] && touch /var/lock/subsys/$prog
61 echo
62 return $ret
63 }
64
65 stop ()
66 {
67 [ `id -u` -eq 0 ] || return 4
68 [ -f /var/lock/subsys/$prog ] || return 0
69 echo -n "Killing $prog: "
70 killproc mdadm
71 echo
72 rm -f /var/lock/subsys/$prog
73 }
74
75 restart ()
76 {
77 stop
78 start
79 }
80
81 condrestart ()
82 {
83 [ -e /var/lock/subsys/$prog ] && restart || return 0
84 }
85
86
87 case "$1" in
88 start) start; RETVAL=$? ;;
89 stop) stop; RETVAL=$? ;;
90 status) status mdadm; RETVAL=$? ;;
91 restart) restart; RETVAL=$? ;;
92 reload) RETVAL=3 ;;
93 condrestart|try-restart|force-reload) condrestart; RETVAL=$? ;;
94 *) usage ; RETVAL=2 ;;
95 esac
96
97 exit $RETVAL

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