1 |
slords |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
# mdmdp This starts, stops, and reloads the mdmpd-based |
4 |
|
|
# multipath device monitoring and management facility |
5 |
|
|
# |
6 |
|
|
# chkconfig: - 15 85 |
7 |
|
|
# description: multipath device monitoring and management |
8 |
|
|
# |
9 |
|
|
|
10 |
|
|
# Copyright 2002 Red Hat, Inc. |
11 |
|
|
|
12 |
|
|
PATH=/sbin:/usr/sbin:$PATH |
13 |
|
|
RETVAL=0 |
14 |
|
|
|
15 |
|
|
prog=mdmpd |
16 |
|
|
|
17 |
|
|
# Source function library. |
18 |
|
|
. /etc/rc.d/init.d/functions |
19 |
|
|
|
20 |
|
|
# Make sure configuration file exists and has information we can use |
21 |
|
|
# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor |
22 |
|
|
#[ -f /etc/mdadm.conf ] || exit 0 |
23 |
|
|
#grep '^\(MAILADDR\|PROGRAM\) .' /etc/mdadm.conf >/dev/null 2>&1 || exit 0 |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
usage () |
27 |
|
|
{ |
28 |
|
|
echo "Usage: service $prog {start|stop|status|restart|condrestart}" |
29 |
|
|
RETVAL=1 |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
start () |
34 |
|
|
{ |
35 |
|
|
ulimit -S -c 0 >/dev/null 2>&1 |
36 |
|
|
# clean up in case we went down unexpectedly |
37 |
|
|
rm -f /var/run/$prog/* |
38 |
|
|
echo -n $"Starting $prog: " |
39 |
|
|
daemon mdmpd |
40 |
|
|
# hack: wait for mdadm to die, assume success if it doesn't die quickly |
41 |
|
|
usleep 100000 |
42 |
|
|
pid=`pidof -o $$ -o $PPID -o %PPID -x $prog` |
43 |
|
|
if [ -n "$pid" ] ; then |
44 |
|
|
success $"mdmpd" |
45 |
|
|
touch /var/lock/subsys/$prog |
46 |
|
|
echo "$pid" > /var/run/$prog.pid |
47 |
|
|
RETVAL=0 |
48 |
|
|
else |
49 |
|
|
failure $"mdmpd" |
50 |
|
|
RETVAL=1 |
51 |
|
|
fi |
52 |
|
|
echo |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
stop () |
56 |
|
|
{ |
57 |
|
|
echo -n $"Stopping $prog: " |
58 |
|
|
killproc $prog |
59 |
|
|
echo |
60 |
|
|
rm -f /var/run/$prog.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 $prog ;; |
80 |
|
|
restart|reload) restart ;; |
81 |
|
|
condrestart) condrestart ;; |
82 |
|
|
*) usage ;; |
83 |
|
|
esac |
84 |
|
|
|
85 |
|
|
exit $RETVAL |