-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathndp-proxy-init
More file actions
77 lines (67 loc) · 1.53 KB
/
ndp-proxy-init
File metadata and controls
77 lines (67 loc) · 1.53 KB
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
#!/bin/sh
#
# chkconfig: 345 99 01
# description: ndp-proxy daemon
#
### BEGIN INIT INFO
# Provides: ndp-proxy
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: ndp-proxy daemon
# Description: ndp-proxy daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
DAEMON_NAME=ndp-proxy
DAEMON_PROCESS=ndp-proxy
DAEMON_BINARY=ndp-proxy
LOCK_FILE=/var/lock/subsys/$DAEMON_NAME
PID_FILE=/var/run/$DAEMON_NAME.pid
RETVAL=0
# default option, they can be overriden in /etc/sysconfig/$DAEMON_NAME or /etc/default/$DAEMON_NAME
OPTIONS=-d
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME
[ -f /etc/default/$DAEMON_NAME ] && . /etc/default/$DAEMON_NAME
start() {
[ -f $LOCK_FILE ] && return
echo -n "Starting $DAEMON_NAME: "
# use --user to run the daemon under the specified uid
daemon $DAEMON_BINARY $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
}
stop() {
echo -n "Shutting down $DAEMON_NAME: "
killproc -p $PID_FILE $DAEMON_PROCESS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $DAEMON_PROCESS
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ]; then
stop
start
fi
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL