#!/bin/sh # # Ubound # # Startup script for Ubuntu / Debian Linux PATH=/sbin:/bin:/usr/sbin:/usr/bin CONFFILE=/usr/local/etc/unbound/unbound.conf PIDFILE=/var/run/unbound/unbound.pid NAME=unbound DAEMON=/usr/local/sbin/unbound . /lib/lsb/init-functions DISTRO=$(lsb_release -is 2>/dev/null || echo Debian) case "$1" in start) log_daemon_msg "Starting caching name service..." # dirs under /var/run can go away on reboots. mkdir -p /var/run/unbound chmod 775 /var/run/unbound chown root:unbound /var/run/unbound >/dev/null 2>&1 || true if [ ! -x $DAEMON ]; then log_action_msg "unbound binary missing - not starting" log_end_msg 1 exit 1 fi start-stop-daemon --start --quiet --exec $DAEMON \ --pidfile $PIDFILE -- -c $CONFFILE > /dev/null 2>&1 log_end_msg 0 ;; stop) log_daemon_msg "Stopping caching name service..." if [ -f $PIDFILE ]; then kill -10 `cat $PIDFILE` echo "$NAME" rm -f $PIDFILE else echo "No $DAEMON found running; none killed." fi log_end_msg 0 ;; restart) $0 stop sleep 2 $0 start ;; *) log_action_msg "Usage: /etc/init.d/unbound {start|stop|restart}" exit 1 ;; esac exit 0