3 # Copyright (C) 2007-2009 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
24 # Provides: lvm2-monitor
25 # Required-Start: $local_fs
26 # Required-Stop: $local_fs
27 # Default-Start: 1 2 3 4 5
29 # Short-Description: Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
32 .
/etc
/init.d
/functions
35 DMEVENTD_DAEMON
=dmeventd
39 VGCHANGE
="$sbindir/vgchange"
43 LOCK_FILE
="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
44 PID_FILE
="@DMEVENTD_PIDFILE@"
47 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES
=1
50 status
-p "$PID_FILE" "$DMEVENTD_DAEMON"
54 rh_status
>/dev
/null
2>&1
59 # TODO do we want to separate out already active groups only?
60 VGSLIST
=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
63 action
"Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y
--poll y
--ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret
=$?
73 # TODO do we want to separate out already active groups only?
74 if test "$WARN" = "1"; then
75 echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
78 VGSLIST
=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
81 action
"Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n
--ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret
=$?
88 # See how we were called.
94 [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
102 [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
106 rh_status_q ||
exit 0
107 test "$runlevel" = "0" && WARN
=0
108 test "$runlevel" = "6" && WARN
=0
111 [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
126 [ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name
,seg_monitor
130 echo $
"Usage: $0 {start|stop|restart|status|force-stop}"