summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2007-01-30 18:02:15 +0000
committerAlasdair Kergon <agk@redhat.com>2007-01-30 18:02:15 +0000
commit319e74e2dab31cc7619dce6ece493729c1e95822 (patch)
treed06474b27e058a039d130766c20bc63f965df326
parentce4c33102fb5d927776d03aa9080224c1a38c050 (diff)
downloadlvm2-319e74e2dab31cc7619dce6ece493729c1e95822.tar.gz
lvm2-319e74e2dab31cc7619dce6ece493729c1e95822.tar.xz
lvm2-319e74e2dab31cc7619dce6ece493729c1e95822.zip
Add warning to lvm2_monitoring_init_rhel4 if attempting to stop monitoring.
-rw-r--r--WHATS_NEW1
-rw-r--r--scripts/lvm2_monitoring_init_rhel442
2 files changed, 26 insertions, 17 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 97b68aae..b3992dc8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.21 -
===================================
+ Add warning to lvm2_monitoring_init_rhel4 if attempting to stop monitoring.
Fix vgsplit to handle mirrors.
Reorder fields in reporting field definitions.
Fix vgs to treat args as VGs even when PV fields are displayed.
diff --git a/scripts/lvm2_monitoring_init_rhel4 b/scripts/lvm2_monitoring_init_rhel4
index 3f2360d7..3e84dfde 100644
--- a/scripts/lvm2_monitoring_init_rhel4
+++ b/scripts/lvm2_monitoring_init_rhel4
@@ -25,11 +25,11 @@
. /etc/init.d/functions
VGCHANGE="/usr/sbin/vgchange"
+WARN=1
start()
{
- for ret in 0
- do
+ ret=0
# TODO do we want to separate out already active groups only?
VGS=`vgs --noheadings -o name`
for vg in $VGS
@@ -40,50 +40,58 @@ start()
fi
done
- done
-
- return $ret
+ return $ret
}
stop()
{
- for ret in 0
- do
+ ret=0
# TODO do we want to separate out already active groups only?
+ if test "$WARN" = "1"; then
+ echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
+ return 1
+ fi
VGS=`vgs --noheadings -o name`
for vg in $VGS
do
- if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor n $vg
+ if ! action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg
then
ret=$?
fi
done
-
- done
-
+ return $ret
}
-ret=1
+result=1
# See how we were called.
case "$1" in
start)
start
- ret=$?
+ result=$?
+ ;;
+
+ force-stop)
+ WARN=0
+ stop
+ result=$?
;;
stop)
+ test "$runlevel" = "0" && WARN=0
+ test "$runlevel" = "6" && WARN=0
stop
- ret=$?
+ result=$?
;;
restart)
+ WARN=0
if stop
then
start
fi
- ret=$?
+ result=$?
;;
status)
@@ -91,8 +99,8 @@ case "$1" in
;;
*)
- echo $"Usage: $0 {start|stop|restart|status}"
+ echo $"Usage: $0 {start|stop|restart|status|force-stop}"
;;
esac
-exit $ret
+exit $result