Bug#400205: init script for clvm

andremachado andremachado at techforce.com.br
Tue May 22 15:41:32 UTC 2007


Hello,
I found at http://xenamo.sourceforge.net/ar01s02.html#sub:Redhat-cluster-suite
a very usefull init.d script.
With some modifications, I attached bellow an improved version that could be included in the lvm2 source package for the clvm binary package.
Regards.
Andre Felipe Machado
PS: maybe the start and stop should fail actually, issuing an invoke-rc.d error. Please, check Debian Policy.

#! /bin/sh

#
# clvmd         Start/Stop script for the cluster LVM daemon
#
# Author:       Daniel Bertolo <dbertolo at hsr.ch>.
#
# Version:      @(#)clvmd  1.00  25-Jun-2006  dbertolo at hsr.ch
# Version:      @(#)clvmd  1.01  22-May-2007  andremachado % techforce.com.br
#

set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="The cluster LVM daemon"
NAME=clvmd
DAEMON=/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME


# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

#
#       Function that starts the daemon/service.
#
d_start() {
        start-stop-daemon --start --exec $DAEMON
}
#
#       Function that stops the daemon/service.
#
d_stop() {
        start-stop-daemon --stop --exec $DAEMON
}
#
#       Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
        start-stop-daemon --stop --exec $DAEMON --signal 1
}
case "$1" in
  start)
        echo -n "Starting $DESC: $NAME "
	if ! d_start; then
		sleep 5
	else
	        echo "."
	fi
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME "
	if ! d_stop; then
	        sleep 5
	else
		echo "."
	fi
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo  -n "Restarting $DESC: $NAME "
	if ! d_stop; then
	        sleep 5
	else
		sleep 1
	fi
	if ! d_start; then
		sleep 5
	else
	        echo "."
	fi
        ;;
  *)
        # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: invoke-rc.d $NAME {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac
exit 0








More information about the pkg-lvm-maintainers mailing list