-
Notifications
You must be signed in to change notification settings - Fork 4
/
netgwm.init.d
executable file
·87 lines (78 loc) · 1.84 KB
/
netgwm.init.d
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: netgwm
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $network
# Should-Stop: $network
# X-Start-Before: network
# X-Stop-After: network
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: runs script for NetGWM (Network Gateway Manager)
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/netgwm
NAME=netgwm
PIDFILE=/var/run/$NAME.pid
DESC="NetGWM (Network Gateway Manager) service"
START=no
DEFAULT_CONFIG=/etc/default/netgwm
unset TMPDIR
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
. $DEFAULT_CONFIG
# Get the timezone set.
if [ -z "$TZ" -a -e /etc/timezone ]; then
TZ=`cat /etc/timezone`
export TZ
fi
case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME"
case "$START" in
"YES"|"Yes"|"yes"|"True"|"TRUE"|"true")
start-stop-daemon --start -b --quiet --pidfile "$PIDFILE" --exec "$DAEMON" && success=1
log_end_msg $?
;;
*)
echo ""
echo "netgwm not configured to start, see \$START in $DEFAULT_CONFIG"
;;
esac
;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --retry 5 --signal 15 --pidfile $PIDFILE --name $NAME && success=1
rm $PIDFILE
log_end_msg $?
;;
reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
restart)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
status)
echo -n "Status of $DESC: "
if [ ! -r "$PIDFILE" ]; then
echo "$NAME is not running."
exit 3
fi
if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
echo "$NAME is running."
exit 0
else
echo "$NAME is not running but $PIDFILE exists."
exit 1
fi
;;
*)
N=/etc/init.d/${0##*/}
echo "Usage: $N {start|stop|status}" >&2
exit 1
;;
esac
exit 0