]> git.pld-linux.org Git - packages/multipath-tools.git/blob - multipathd.init
ec51442becccce35a30c255746c492f664a737f3
[packages/multipath-tools.git] / multipathd.init
1 #!/bin/sh
2 #
3 # multipathd    Starts multipath daemon
4 #
5 # chkconfig:    345 10 90
6 #
7 # description:  The multipathd daemon is in charge of checking for failed paths.
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get service config - may override defaults
15 [ -f /etc/sysconfig/multipathd ] && . /etc/sysconfig/multipathd
16
17 start() {
18         # Check if the service is already running?
19         if [ -f /var/lock/subsys/multipathd ]; then
20                 msg_already_running "multipath daemon"
21                 return
22         fi
23
24         msg_starting "multipath daemon"
25         modprobe dm-multipath
26         daemon /sbin/multipathd
27         RETVAL=$?
28         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/multipathd
29 }
30
31 stop() {
32         if [ ! -f /var/lock/subsys/multipathd ]; then
33                 msg_not_running "multipath daemon"
34                 return
35         fi
36
37         # Stop daemons.
38         msg_stopping "multipath daemon"
39         killproc --pidfile multipathd.pid multipathd -TERM
40         rm -f /var/lock/subsys/multipathd
41 }
42
43 condrestart() {
44         if [ ! -f /var/lock/subsys/multipathd ]; then
45                 msg_not_running "multipath daemon"
46                 RETVAL=$1
47                 return
48         fi
49
50         stop
51         start
52 }
53
54
55 RETVAL=0
56 # See how we were called.
57 case "$1" in
58   start)
59         start
60         ;;
61   stop)
62         stop
63         ;;
64   restart)
65         stop
66         start
67         ;;
68   try-restart)
69         condrestart 0
70         ;;
71   force-reload)
72         condrestart 7
73         ;;
74   status)
75         status multipathd
76         RETVAL=$?
77         ;;
78   *)
79         msg_usage "$0 {start|stop|status|restart|try-restart|force-reload}"
80         exit 3
81         ;;
82 esac
83
84 exit $RETVAL
This page took 0.028192 seconds and 2 git commands to generate.