45 lines
782 B
Bash
45 lines
782 B
Bash
#!/bin/sh
|
|
|
|
# This is usually needed for detecting multipaths. The default 5 seems
|
|
# to work, but adjustment per case may be needed.
|
|
SLEEP=5
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
DAEMON=/sbin/multipathd
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
case "$1" in
|
|
start)
|
|
pgrep -f $DAEMON >/dev/null
|
|
if [ $? = 0 ]; then
|
|
echo 'multipathd is already running'
|
|
exit 1
|
|
fi
|
|
echo -n "Starting multipath daemon: $DAEMON ."
|
|
$DAEMON
|
|
echo -n '.'; sleep $SLEEP; echo -n '. '
|
|
pgrep -f $DAEMON >/dev/null
|
|
if [ $? = 0 ]; then
|
|
echo "ok"
|
|
else
|
|
echo "error!"
|
|
fi
|
|
;;
|
|
stop)
|
|
echo -n "Stopping multipath daemon: multipathd ... "
|
|
$DAEMON shutdown || echo "daemon is not running"
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "Usage: /etc/init.d/multipathd {start|stop|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|