-
Notifications
You must be signed in to change notification settings - Fork 5
/
ibacm.init.in
138 lines (126 loc) · 2.74 KB
/
ibacm.init.in
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
#
# Bring up/down the ibacm daemon
#
# chkconfig: 2345 25 75
# description: Starts/Stops InfiniBand ACM service
#
### BEGIN INIT INFO
# Provides: ibacm
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Required-Start: @rdmascript@ $network
# Required-Stop: @rdmascript@ $network
# Should-Start:
# Should-Stop:
# Short-Description: Starts and stops the InfiniBand ACM service
# Description: The InfiniBand ACM service provides a user space implementation
# of something resembling an ARP cache for InfiniBand SA queries and
# host route lookups.
### END INIT INFO
pidfile=/var/run/ibacm.pid
subsys=/var/lock/subsys/ibacm
daemon() { /sbin/daemon ${1+"$@"}; }
if [ -s /etc/init.d/functions ]; then
# RHEL / CentOS / SL / Fedora
. /etc/init.d/functions
_daemon() { daemon ${1+"$@"}; }
_checkpid() { checkpid `cat $pidfile`; }
_success() { success; echo; }
_failure() { failure; echo; }
elif [ -s /lib/lsb/init-functions ]; then
# SLES / OpenSuSE / Debian
. /lib/lsb/init-functions
_daemon() { /sbin/start_daemon ${1+"$@"}; }
_checkpid() { checkproc -p $pidfile @prefix@/sbin/ibacm; }
_success() { log_success_msg; }
_failure() { log_failure_msg; }
elif [ -s /etc/rc.status ]; then
# Older SuSE
. /etc/rc.status
_daemon() { /sbin/start_daemon ${1+"$@"}; }
_checkpid() { checkproc -p $pidfile @prefix@/sbin/ibacm; }
_success() { rc_status -v; }
_failure() { rc_status -v; }
fi
start()
{
echo -n "Starting ibacm daemon:"
_daemon @prefix@/sbin/ibacm
if [[ $RETVAL -eq 0 ]]; then
_success
else
_failure
fi
}
stop()
{
echo -n "Stopping ibacm daemon:"
killproc -p $pidfile ibacm
if [[ $RETVAL -eq 0 ]]; then
_success
else
_failure
fi
rm -f $subsys
}
status()
{
echo -n "Checking for ibacm service "
if [ ! -f $subsys -a ! -f $pidfile ]; then
RETVAL=3
elif [ -f $pidfile ]; then
_checkpid
RETVAL=$?
elif [ -f $subsys ]; then
RETVAL=2
else
RETVAL=0
fi
if [[ $RETVAL -eq 0 ]]; then
_success
else
_failure
fi
}
restart ()
{
stop
start
}
condrestart ()
{
[ -e $subsys ] && restart || return 0
}
usage ()
{
echo
echo "Usage: `basename $0` {start|stop|restart|condrestart|try-restart|force-reload|status}"
echo
return 2
}
case $1 in
start|stop|restart|condrestart|try-restart|force-reload)
[ `id -u` != "0" ] && exit 4 ;;
esac
case $1 in
start)
start
;;
stop)
stop
;;
restart | reload)
restart
;;
condrestart | try-restart | force-reload)
condrestart
;;
status)
status
;;
*)
usage
;;
esac
exit $RETVAL