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
16 test -x $DAEMON ||
exit 0
18 # Include tor defaults if available
19 if [ -f $DEFAULTSFILE ] ; then
23 wait_for_deaddaemon
() {
28 if kill -0 $pid 2>/dev
/null
32 while kill -0 $pid 2>/dev
/null
35 if [ $cnt -gt $WAITFORDAEMON ]
50 if [ "$RUN_DAEMON" != "yes" ]; then
51 echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
53 echo "Starting $DESC: $NAME..."
54 ulimit -n $MAX_FILEDESCRIPTORS
55 start-stop-daemon
--start --quiet --oknodo \
56 --chuid debian-tor
:debian-tor \
59 --exec $DAEMON -- $ARGS
64 echo -n "Stopping $DESC: "
65 pid
=`cat $TORPID 2>/dev/null` || true
66 if test ! -f $TORPID -o -z "$pid"
68 echo "not running (there is no $TORPID)."
69 elif start-stop-daemon
--stop --signal INT
--quiet --pidfile $TORPID --exec $DAEMON
71 wait_for_deaddaemon
$pid
73 elif kill -0 $pid 2>/dev
/null
75 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
77 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
81 echo -n "Reloading $DESC configuration: "
82 pid
=`cat $TORPID 2>/dev/null` || true
83 if test ! -f $TORPID -o -z "$pid"
85 echo "not running (there is no $TORPID)."
86 elif start-stop-daemon
--stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON
89 elif kill -0 $pid 2>/dev
/null
91 echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
93 echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
102 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2