| 1 |
#!/bin/sh |
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: dnsproxy |
| 4 |
# Required-Start: $remote_fs $syslog $named |
| 5 |
# Required-Stop: $remote_fs $syslog |
| 6 |
# Default-Start: 2 3 4 5 |
| 7 |
# Default-Stop: 0 1 6 |
| 8 |
# Short-Description: Init script for dnsproxy |
| 9 |
# Description: This is the init script for dnsproxy. |
| 10 |
### END INIT INFO |
| 11 |
|
| 12 |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 13 |
DAEMON=/usr/sbin/dnsproxy |
| 14 |
NAME=dnsproxy |
| 15 |
DESC=dnsproxy |
| 16 |
|
| 17 |
test -x $DAEMON || exit 0 |
| 18 |
|
| 19 |
. /lib/lsb/init-functions |
| 20 |
|
| 21 |
DODTIME=1 # Time to wait for the server to die, in seconds |
| 22 |
# If this value is set too low you might not |
| 23 |
# let some servers to die gracefully and |
| 24 |
# 'restart' will not work |
| 25 |
|
| 26 |
# Include dnsproxy defaults if available |
| 27 |
if [ -f /etc/default/$NAME ] ; then |
| 28 |
. /etc/default/$NAME |
| 29 |
fi |
| 30 |
DAEMON_OPTS="$DAEMON_OPTS -d" |
| 31 |
|
| 32 |
case "$1" in |
| 33 |
start) |
| 34 |
log_daemon_msg "Starting $DESC" "$NAME" |
| 35 |
start_daemon $DAEMON $DAEMON_OPTS |
| 36 |
log_end_msg $? |
| 37 |
;; |
| 38 |
stop) |
| 39 |
log_daemon_msg "Stopping $DESC" "$NAME" |
| 40 |
start-stop-daemon --stop --exec $DAEMON |
| 41 |
RETVAL=$? |
| 42 |
log_end_msg $RETVAL |
| 43 |
;; |
| 44 |
restart|reload|force-reload) |
| 45 |
log_daemon_msg "Restarting $DESC" "$NAME" |
| 46 |
$0 stop |
| 47 |
[ -n "$DODTIME" ] && sleep $DODTIME |
| 48 |
$0 start |
| 49 |
;; |
| 50 |
status) |
| 51 |
start-stop-daemon --status --exec $DAEMON |
| 52 |
RETVAL=$? |
| 53 |
if [ "$RETVAL" = "0" ]; then |
| 54 |
echo "$NAME is running." |
| 55 |
else |
| 56 |
echo "$NAME is not running." |
| 57 |
fi |
| 58 |
exit $RETVAL |
| 59 |
;; |
| 60 |
*) |
| 61 |
N=/etc/init.d/$NAME |
| 62 |
log_action_msg "Usage: $N {start|stop|restart|reload|force-reload|status}" |
| 63 |
exit 1 |
| 64 |
;; |
| 65 |
esac |
| 66 |
|
| 67 |
exit 0 |