mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Generate clvmd init script at configuration time for Red Hat-based distros.
This commit is contained in:
parent
281ee1c2bf
commit
d80d9a4c4e
@ -1,5 +1,6 @@
|
||||
Version 2.02.44 -
|
||||
====================================
|
||||
Generate Red Hat clvmd startup script at configuration time with correct paths.
|
||||
Fix clvmd & dmeventd builds after tree restructuring.
|
||||
Cope with snapshot dependencies when removing a whole VG with lvremove.
|
||||
Make man pages consistent with either-or options (use "|" everywhere).
|
||||
|
@ -803,6 +803,7 @@ libdm/Makefile
|
||||
libdm/libdevmapper.pc
|
||||
man/Makefile
|
||||
po/Makefile
|
||||
scripts/clvmd_init_red_hat
|
||||
scripts/Makefile
|
||||
test/Makefile
|
||||
tools/Makefile
|
||||
|
@ -1,90 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.d/init.d/clvmd
|
||||
#
|
||||
# Starts the clvm daemon
|
||||
# NOTE: These startup levels may not be right yet - it depends on where
|
||||
# the rest of the cluster startup goes.
|
||||
#
|
||||
# chkconfig: 345 72 5
|
||||
# description: distributes LVM commands in a clustered environment. \
|
||||
# a clvmd must be run on all nodes in a cluster for clustered LVM \
|
||||
# operations to work.
|
||||
# processname: clvmd
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
BINARY=/usr/sbin/clvmd
|
||||
LOCKFILE=/var/lock/subsys/clvmd
|
||||
|
||||
test -x "$BINARY" || exit 0
|
||||
|
||||
RETVAL=0
|
||||
|
||||
#
|
||||
# See how we were called.
|
||||
#
|
||||
|
||||
prog="clvmd"
|
||||
|
||||
start() {
|
||||
# Check if clvmd is already running
|
||||
if [ ! -f "$LOCKFILE" ]; then
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $BINARY
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||
echo
|
||||
fi
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $BINARY
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
status_clvm() {
|
||||
status $BINARY
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
reload|restart)
|
||||
restart
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f $LOCKFILE ]; then
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status_clvm
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
exit $RETVAL
|
@ -1,140 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# chkconfig: - 24 76
|
||||
# description: Starts and stops clvmd
|
||||
#
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/init.d/functions
|
||||
|
||||
LVDISPLAY="/usr/sbin/lvdisplay"
|
||||
VGCHANGE="/usr/sbin/vgchange"
|
||||
VGSCAN="/usr/sbin/vgscan"
|
||||
VGDISPLAY="/usr/sbin/vgdisplay"
|
||||
VGS="/usr/sbin/vgs"
|
||||
CLVMDOPTS="-T20"
|
||||
|
||||
[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
|
||||
|
||||
LOCK_FILE="/var/lock/subsys/clvmd"
|
||||
|
||||
start()
|
||||
{
|
||||
for rtrn in 0
|
||||
do
|
||||
if ! pidof clvmd > /dev/null
|
||||
then
|
||||
echo -n "Starting clvmd: "
|
||||
daemon clvmd $CLVMDOPTS
|
||||
rtrn=$?
|
||||
echo
|
||||
if [ $rtrn -ne 0 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
# refresh cache
|
||||
$VGSCAN > /dev/null 2>&1
|
||||
|
||||
if [ -n "$LVM_VGS" ]
|
||||
then
|
||||
for vg in $LVM_VGS
|
||||
do
|
||||
action "Activating VG $vg:" $VGCHANGE -ayl $vg || rtrn=$?
|
||||
done
|
||||
else
|
||||
action "Activating VGs:" $VGCHANGE -ayl || rtrn=$?
|
||||
fi
|
||||
done
|
||||
|
||||
return $rtrn
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
for rtrn in 0
|
||||
do
|
||||
if [ -n "$LVM_VGS" ]
|
||||
then
|
||||
for vg in $LVM_VGS
|
||||
do
|
||||
action "Deactivating VG $vg:" $VGCHANGE -anl $vg || rtrn=$?
|
||||
done
|
||||
else
|
||||
# Hack to only deactivate clustered volumes
|
||||
clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
|
||||
for vg in $clustervgs; do
|
||||
action "Deactivating VG $vg:" $VGCHANGE -anl $vg || rtrn=$?
|
||||
done
|
||||
fi
|
||||
|
||||
[ $rtrn -ne 0 ] && break
|
||||
|
||||
echo -n "Stopping clvm:"
|
||||
killproc clvmd -TERM
|
||||
rtrn=$?
|
||||
echo
|
||||
done
|
||||
|
||||
return $rtrn
|
||||
}
|
||||
|
||||
wait_for_finish()
|
||||
{
|
||||
count=0
|
||||
|
||||
while [ "$count" -le 10 -a -n "`pidof clvmd`" ]
|
||||
do
|
||||
sleep 1
|
||||
count=$((count + 1))
|
||||
done
|
||||
|
||||
if [ `pidof clvmd` ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
rtrn=1
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
rtrn=$?
|
||||
[ $rtrn = 0 ] && touch $LOCK_FILE
|
||||
;;
|
||||
|
||||
stop)
|
||||
stop
|
||||
rtrn=$?
|
||||
[ $rtrn = 0 ] && rm -f $LOCK_FILE
|
||||
;;
|
||||
|
||||
restart)
|
||||
if stop
|
||||
then
|
||||
wait_for_finish
|
||||
start
|
||||
fi
|
||||
rtrn=$?
|
||||
;;
|
||||
|
||||
status)
|
||||
status clvmd
|
||||
rtrn=$?
|
||||
vols=$( $LVDISPLAY -C --nohead 2> /dev/null | awk '($3 ~ /....a./) {print $1}' )
|
||||
echo active volumes: ${vols:-"(none)"}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|status}"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $rtrn
|
Loading…
Reference in New Issue
Block a user