1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00
lvm2/scripts/cmirrord_init_red_hat.in
Milan Broz 6df32fed62 Fix syntax error in cmirror init script
- break cannot be used here
 - remove CLVMDOPTS
 - add echo to stop call
2010-01-22 16:19:38 +00:00

107 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# chkconfig: - 22 78
# description: Starts and stops cmirrord
#
# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
#
### BEGIN INIT INFO
# Provides: cmirrord
# Required-Start: $network $time $local_fs
# Required-Stop: $network $time $local_fs
# Short-Description: Starts and stops cmirrord
# Description: Starts and stops the cluster mirror log daemon
### END INIT INFO
. /etc/init.d/functions
DAEMON=cmirrord
LOCK_FILE="/var/lock/subsys/$DAEMON"
start()
{
if ! pidof $DAEMON > /dev/null
then
echo -n "Starting $DAEMON: "
daemon $DAEMON
rtrn=$?
echo
fi
return $rtrn
}
stop()
{
echo -n "Stopping $DAEMON:"
killproc $DAEMON -TERM
rtrn=$?
echo
return $rtrn
}
wait_for_finish()
{
count=0
while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ]
do
sleep 1
count=$((count + 1))
done
if [ `pidof $DAEMON` ]
then
return 1
else
return 0
fi
}
cmirror_status()
{
status $DAEMON
}
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)
cmirror_status
rtrn=$?
if [ $rtrn -eq 0 ]; then
echo "cmirror is running."
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
;;
esac
exit $rtrn