--- multipathd/multipathd.init.org 2004-11-11 23:00:54.000000000 +0000 +++ multipathd/multipathd.init 2004-11-18 22:54:13.690950296 +0000 @@ -1,35 +1,41 @@ -#!/bin/sh +#!/sbin/runscript -PATH=/bin:/usr/bin:/sbin:/usr/sbin -DAEMON=/usr/bin/multipathd -PIDFILE=/var/run/multipathd.pid +depend() { + need modules +} -test -x $DAEMON || exit 0 +start() { + PIDFILE="/var/run/multipathd.pid" + ebegin "Starting multipath daemon: multipathd" + /usr/bin/multipathd >/dev/null 2>&1 + + while : + do + cnt=$(($cnt + 1)) + if [ -f ${PIDFILE} ]; then + ret=0 + break + fi -case "$1" in - start) - echo -n "Starting multipath daemon: multipathd" - $DAEMON - echo "." - ;; - stop) - echo -n "Stopping multipath daemon: multipathd" - echo "." - if [ -f $PIDFILE ] + if [ $cnt -eq 5 ]; then + eerror "Unable to start multipathd" + ret=1 + break + fi + sleep 1 + done + eend $ret +} + +stop () { + PIDFILE="/var/run/multipathd.pid" + ebegin "Stopping multipath daemon: multipathd" + if [ -f ${PIDFILE} ] then - kill `cat $PIDFILE` + kill `cat ${PIDFILE}` else - echo "multipathd not running: Nothing to stop..." + eerror "multipathd not running: Nothing to stop..." + return 1 fi - ;; - force-reload|restart) - $0 stop - $0 start - ;; - *) - echo "Usage: /etc/init.d/multipathd {start|stop|restart|force-reload}" - exit 1 - ;; -esac - -exit 0 + eend $? +}