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
|
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: hipdnsproxy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: HIP DNS proxy
### END INIT INFO
DNSPROXY_OPTS="-bk"
PID_FILE=/var/run/hipdnsproxy.pid
EXEC=/usr/sbin/hipdnsproxy
export PATH=/usr/sbin:$PATH
set -e
. /lib/lsb/init-functions
test -x $EXEC || exit 0
if test -f /etc/default/hipdnsproxy; then
. /etc/default/hipdnsproxy
fi
start_dnsproxy() {
log_daemon_msg "Starting DNS proxy for HIP" "hipdnsproxy"
if start-stop-daemon --start --quiet --exec $EXEC -- $DNSPROXY_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
}
stop_dnsproxy() {
log_daemon_msg "Stopping DNS proxy for HIP" "hipdnsproxy"
if test -r $PID_FILE && ps $(head -1 $PID_FILE) > /dev/null; then # see bug id 812
if start-stop-daemon --stop --pidfile $PID_FILE --quiet -- $DNSPROXY_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
else
log_end_msg 1
fi
}
case "$1" in
start)
start_dnsproxy
;;
stop)
stop_dnsproxy
;;
restart|force-reload)
stop_dnsproxy
sleep 3
start_dnsproxy
;;
status)
status_of_proc -p $PID_FILE /usr/sbin/hipdnsproxy hipdnsproxy && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/dnsproxy {start|stop|restart|force-reload|status}"
exit 1
esac
exit 0
|