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
13 MAX_FILEDESCRIPTORS
=4096
15 test -x $DAEMON ||
exit 0
17 # Include tor defaults if available
18 if [ -f $DEFAULTSFILE ] ; then
22 wait_for_deaddaemon
() {
27 if kill -0 $pid 2>/dev
/null
31 while kill -0 $pid 2>/dev
/null
34 if [ $cnt -gt $WAITFORDAEMON ]
49 if [ "$RUN_DAEMON" != "yes" ]; then
50 echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
52 echo "Starting $DESC: $NAME..."
53 ulimit -n $MAX_FILEDESCRIPTORS
54 start-stop-daemon
--start --quiet --oknodo \
55 --chuid debian-tor
:debian-tor \
57 --exec $DAEMON -- $ARGS
62 echo -n "Stopping $DESC: "
63 pid
=`cat $TORPID 2>/dev/null` || true
64 if test ! -f $TORPID -o -z "$pid"
66 echo "not running (there is no $TORPID)."
67 elif start-stop-daemon
--stop --signal INT
--quiet --pidfile $TORPID --exec $DAEMON
69 wait_for_deaddaemon
$pid
71 elif kill -0 $pid 2>/dev
/null
73 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
75 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
79 echo -n "Reloading $DESC configuration: "
80 pid
=`cat $TORPID 2>/dev/null` || true
81 if test ! -f $TORPID -o -z "$pid"
83 echo "not running (there is no $TORPID)."
84 elif start-stop-daemon
--stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON
87 elif kill -0 $pid 2>/dev
/null
89 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
91 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
100 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2