move the daemon back to /usr/bin/tor
[tor.git] / debian / tor.init
blob2a037ee5aeba1a95b1149600e89244482c3c6867
1 #! /bin/sh
3 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4 DAEMON=/usr/bin/tor
5 NAME=tor
6 DESC="tor daemon"
7 TORLOG=/var/log/tor/log
8 TORPID=/var/run/tor/tor.pid
9 ARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1"
11 test -x $DAEMON || exit 0
13 # Include tor defaults if available
14 if [ -f /etc/default/tor ] ; then
15 . /etc/default/tor
18 set -e
20 case "$1" in
21 start)
22 if [ "$RUN_DAEMON" != "yes" ]; then
23 echo "Not starting $DESC (Disabled in /etc/default/tor)."
24 else
25 echo -n "Starting $DESC: "
26 start-stop-daemon --start --quiet --oknodo \
27 --chuid debian-tor:debian-tor \
28 --pidfile $TORPID \
29 --exec $DAEMON -- $ARGS
30 echo "$NAME."
33 stop)
34 echo -n "Stopping $DESC: "
35 start-stop-daemon --stop --quiet --oknodo --pidfile $TORPID \
36 --exec $DAEMON
37 echo "$NAME."
39 reload|force-reload)
40 echo "Reloading $DESC configuration."
41 start-stop-daemon --stop --signal 1 --oknodo --quiet --pidfile $TORPID \
42 --exec $DAEMON
44 restart)
45 $0 stop
46 sleep 1
47 $0 start
50 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
51 exit 1
53 esac
55 exit 0