mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 22:53:44 +01:00
a2131d62bf
(it seems many people don't know they have a /usr/local/sbin/ damn the file system hierarchy standards) svn:r1120
56 lines
1.1 KiB
Bash
56 lines
1.1 KiB
Bash
#! /bin/sh
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
DAEMON=/usr/bin/tor
|
|
NAME=tor
|
|
DESC="tor daemon"
|
|
TORLOG=/var/log/tor/log
|
|
TORPID=/var/run/tor/tor.pid
|
|
ARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1"
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
# Include tor defaults if available
|
|
if [ -f /etc/default/tor ] ; then
|
|
. /etc/default/tor
|
|
fi
|
|
|
|
set -e
|
|
|
|
case "$1" in
|
|
start)
|
|
if [ "$RUN_DAEMON" != "yes" ]; then
|
|
echo "Not starting $DESC (Disabled in /etc/default/tor)."
|
|
else
|
|
echo -n "Starting $DESC: "
|
|
start-stop-daemon --start --quiet --oknodo \
|
|
--chuid debian-tor:debian-tor \
|
|
--pidfile $TORPID \
|
|
--exec $DAEMON -- $ARGS
|
|
echo "$NAME."
|
|
fi
|
|
;;
|
|
stop)
|
|
echo -n "Stopping $DESC: "
|
|
start-stop-daemon --stop --quiet --oknodo --pidfile $TORPID \
|
|
--exec $DAEMON
|
|
echo "$NAME."
|
|
;;
|
|
reload|force-reload)
|
|
echo "Reloading $DESC configuration."
|
|
start-stop-daemon --stop --signal 1 --oknodo --quiet --pidfile $TORPID \
|
|
--exec $DAEMON
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|