aboutsummaryrefslogtreecommitdiff
path: root/system/multipath-tools/rc.multipathd.new
blob: e62690fa8f07f07b19266dd74f612dd10fd4af0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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