]> sourceware.org Git - lvm2.git/blame - scripts/lvm2_monitoring_init_rhel4
Refer to details of snapshot of raid problem.
[lvm2.git] / scripts / lvm2_monitoring_init_rhel4
CommitLineData
20db8ffc
AK
1#!/bin/bash
2#
3# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
4#
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.
8#
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
12#
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.
16#
17#
18# chkconfig: 12345 02 99
19# description: Starts and stops dmeventd monitoring for lvm2
20#
21### BEGIN INIT INFO
22# Provides:
23### END INIT INFO
24
25. /etc/init.d/functions
26
27VGCHANGE="/usr/sbin/vgchange"
319e74e2 28WARN=1
20db8ffc
AK
29
30start()
31{
319e74e2 32 ret=0
20db8ffc 33 # TODO do we want to separate out already active groups only?
0644371f 34 VGS=`vgs --noheadings -o name --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
20db8ffc
AK
35 for vg in $VGS
36 do
32e53e50 37 action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
20db8ffc
AK
38 done
39
319e74e2 40 return $ret
20db8ffc
AK
41}
42
43
44stop()
45{
319e74e2 46 ret=0
20db8ffc 47 # TODO do we want to separate out already active groups only?
319e74e2
AK
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
51 fi
0644371f 52 VGS=`vgs --noheadings -o name --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
20db8ffc
AK
53 for vg in $VGS
54 do
32e53e50 55 action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
20db8ffc 56 done
319e74e2 57 return $ret
20db8ffc
AK
58}
59
319e74e2 60result=1
20db8ffc
AK
61
62# See how we were called.
63case "$1" in
64 start)
65 start
319e74e2
AK
66 result=$?
67 ;;
68
69 force-stop)
70 WARN=0
71 stop
72 result=$?
20db8ffc
AK
73 ;;
74
75 stop)
319e74e2
AK
76 test "$runlevel" = "0" && WARN=0
77 test "$runlevel" = "6" && WARN=0
20db8ffc 78 stop
319e74e2 79 result=$?
20db8ffc
AK
80 ;;
81
82 restart)
319e74e2 83 WARN=0
20db8ffc
AK
84 if stop
85 then
86 start
87 fi
319e74e2 88 result=$?
20db8ffc
AK
89 ;;
90
91 status)
92 # TODO anyone with an idea how to dump monitored volumes?
93 ;;
94
95 *)
319e74e2 96 echo $"Usage: $0 {start|stop|restart|status|force-stop}"
20db8ffc
AK
97 ;;
98esac
99
319e74e2 100exit $result
This page took 0.068974 seconds and 5 git commands to generate.