Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / scripts / lvm2_monitoring_init_rhel4
blob0a42f552bebc54a00fd4b24eb48ccd69526611d4
1 #!/bin/bash
3 # Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5 # This copyrighted material is made available to anyone wishing to use,
6 # modify, copy, or redistribute it subject to the terms and conditions
7 # of the GNU General Public License v.2.
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software Foundation,
11 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13 # This file is part of LVM2.
14 # It is required for the proper handling of failures of LVM2 mirror
15 # devices that were created using the -m option of lvcreate.
18 # chkconfig: 12345 02 99
19 # description: Starts and stops dmeventd monitoring for lvm2
21 ### BEGIN INIT INFO
22 # Provides:
23 ### END INIT INFO
25 . /etc/init.d/functions
27 VGCHANGE="/usr/sbin/vgchange"
28 WARN=1
30 start()
32 ret=0
33 # TODO do we want to separate out already active groups only?
34 VGS=`vgs --noheadings -o name 2> /dev/null`
35 for vg in $VGS
37 action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg || ret=$?
38 done
40 return $ret
44 stop()
46 ret=0
47 # TODO do we want to separate out already active groups only?
48 if test "$WARN" = "1"; then
49 echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
50 return 1
52 VGS=`vgs --noheadings -o name 2> /dev/null`
53 for vg in $VGS
55 action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg || ret=$?
56 done
57 return $ret
60 result=1
62 # See how we were called.
63 case "$1" in
64 start)
65 start
66 result=$?
69 force-stop)
70 WARN=0
71 stop
72 result=$?
75 stop)
76 test "$runlevel" = "0" && WARN=0
77 test "$runlevel" = "6" && WARN=0
78 stop
79 result=$?
82 restart)
83 WARN=0
84 if stop
85 then
86 start
87 fi
88 result=$?
91 status)
92 # TODO anyone with an idea how to dump monitored volumes?
96 echo $"Usage: $0 {start|stop|restart|status|force-stop}"
98 esac
100 exit $result