5 PATH
=/usr
/local
/sbin
:/usr
/local
/bin
:/sbin
:/bin
:/usr
/sbin
:/usr
/bin
9 TORPID
=/var
/run
/tor
/tor.pid
10 DEFAULTSFILE
=/etc
/default
/$NAME
14 test -x $DAEMON ||
exit 0
16 # Include tor defaults if available
17 if [ -f $DEFAULTSFILE ] ; then
21 wait_for_deaddaemon
() {
26 if kill -0 $pid 2>/dev
/null
30 while kill -0 $pid 2>/dev
/null
33 if [ $cnt -gt $WAITFORDAEMON ]
48 if [ "$RUN_DAEMON" != "yes" ]; then
49 echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
51 echo "Starting $DESC: $NAME..."
52 start-stop-daemon
--start --quiet --oknodo \
53 --chuid debian-tor
:debian-tor \
55 --exec $DAEMON -- $ARGS
60 echo -n "Stopping $DESC: "
61 pid
=`cat $TORPID 2>/dev/null` || true
62 if test ! -f $TORPID -o -z "$pid"
64 echo "not running (there is no $TORPID)."
65 elif start-stop-daemon
--stop --quiet --pidfile $TORPID --exec $DAEMON
67 wait_for_deaddaemon
$pid
69 elif kill -0 $pid 2>/dev
/null
71 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
73 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
77 echo -n "Reloading $DESC configuration: "
78 pid
=`cat $TORPID 2>/dev/null` || true
79 if test ! -f $TORPID -o -z "$pid"
81 echo "not running (there is no $TORPID)."
82 elif start-stop-daemon
--stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON
85 elif kill -0 $pid 2>/dev
/null
87 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
89 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
98 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2