#! /bin/sh # # dante SOCKS server init.d file. Based on /etc/init.d/skeleton: # Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl # NAME of this script may be `danted' or `danted-authenticating' NAME=$(basename $0) # If basename is like "S20danted", then strip the first 3 characters if echo $NAME | grep -q '^[SK][0-9][0-9]' then NAME=`echo $NAME | cut -c 4-` fi PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/danted DESC="Dante SOCKS daemon" CONFFILE=/etc/$NAME.conf # danted always writes PIDFILE to /var/run/danted.pid, even when started # multiple times with different config files! So we need to keep our own # lockfiles separately. PIDFILE=/var/run/initscript-lockfiles/$NAME.pid test -f $DAEMON || exit 0 test -f $CONFFILE || { echo "error: $CONFFILE does not exist" 1>&2; exit 2; } test -d `dirname "$PIDFILE"` || mkdir -p `dirname "$PIDFILE"` set -e case "$1" in start) echo "Starting $DESC: $NAME" start-stop-daemon --start --pidfile $PIDFILE \ --startas $DAEMON --make-pidfile --background \ -- -f $CONFFILE ;; stop) echo "Stopping $DESC: $NAME" start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE rm -f "$PIDFILE" ;; reload|force-reload) echo "Reloading $DESC: $NAME configuration files." start-stop-daemon --stop --signal 1 --quiet \ --pidfile $PIDFILE ;; restart) echo "Restarting $DESC: $NAME" start-stop-daemon --stop --quiet --pidfile $PIDFILE || : rm -f "$PIDFILE" sleep 1 start-stop-daemon --start --quiet --pidfile $PIDFILE \ --startas $DAEMON --make-pidfile --background \ -- -f $CONFFILE ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0