File: opensm.init

package info (click to toggle)
opensm 3.3.23-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 6,924 kB
  • sloc: ansic: 97,383; yacc: 2,227; sh: 685; lex: 404; makefile: 391; perl: 143
file content (86 lines) | stat: -rw-r--r-- 1,639 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
### BEGIN INIT INFO
# Provides:          opensm
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start opensm subnet manager.
# Description:       Enable opensm subnet manager.
### END INIT INFO

. /lib/lsb/init-functions

PORTS=""
[ -f /etc/default/opensm ] &&  . /etc/default/opensm

[ -x /usr/sbin/opensm ] || exit 0

if [ ! -f /sys/class/infiniband_mad/abi_version ] ; then
echo "No infiniband adapters found."
exit 0
fi


start () {

if [ "$PORTS" = "ALL" ]; then
PORTS=`/usr/sbin/ibstat -p`
fi

if [ "$PORTS" = "NONE" ]; then
echo "opensm disabled."
exit 0
fi

for PORT in $PORTS ; do
    echo -n "Starting opensm on $PORT: "
    start-stop-daemon --start --quiet --make-pidfile  --pidfile /var/run/opensm-$PORT --background --exec /usr/sbin/opensm -- -g $PORT -f /var/log/opensm.$PORT.log
    RETVAL=$?
    echo
done
}

stop () {

if [ "$PORTS" = "ALL" ]; then
PORTS=`/usr/sbin/ibstat -p`
fi

if [ "$PORTS" = "NONE" ]; then
    echo "opensm disabled."
    exit 0
fi
for PORT in $PORTS ; do
    echo -n "Shutting down opensm on $PORT: "
    start-stop-daemon --stop --pidfile /var/run/opensm-$PORT 
    RETVAL=$?
    echo
done
}


case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart | force-reload )
        stop
	start
        ;;
    reload)
    echo "Reloading opensm configuration..."
        killall -HUP opensm
	RETVAL=$?
	echo "done"
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|reload|force-reload}"
        RETVAL=1
        ;;
esac

exit $RETVAL;