forked from cabal95/pybsdp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrhel.init
executable file
·68 lines (64 loc) · 1.27 KB
/
rhel.init
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
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: bsdpd
# Default-Start:
# Default-Stop:
# Should-Start: portreserve
# Required-Start: $network
# Required-Stop:
# Short-Description: Start and stop the BSDP server
# Description: bsdpd provides the Boot Service Discovery Protocol (BSDP)
# server.
### END INIT INFO
#
# chkconfig: - 65 35
# description: bsdpd provides the Boot Service Discovery Protocol (BSDP) \
# server
# pidfile: /var/run/bsdpd.pid
EXEC="/usr/local/bsdp/sbin/bsdpd.py"
PROG=bsdpd
PIDFILE=/var/run/$PROG.pid
case "$1" in
start)
printf "%-59s" "Starting $PROG:"
PID=`$EXEC > /dev/null 2>&1 & echo $!`
if [ -z $PID ]; then
printf "%s\n" "[FAILED]"
else
echo $PID > $PIDFILE
printf "%s\n" "[ OK ]"
fi
;;
status)
printf "$PROG "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
printf "%s\n" "dead but pid file exists"
else
echo "(pid $PID) is running..."
fi
else
echo "is stopped"
fi
;;
stop)
printf "%-59s" "Stopping $PROG:"
PID=`cat $PIDFILE`
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "%s\n" "[ OK ]"
rm -f $PIDFILE
else
printf "%s\n" "pid file not found"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac