diff options
Diffstat (limited to 'network/tor/rc.tor')
-rw-r--r-- | network/tor/rc.tor | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/network/tor/rc.tor b/network/tor/rc.tor index d7ef906aae..cdeb865af3 100644 --- a/network/tor/rc.tor +++ b/network/tor/rc.tor @@ -1,43 +1,42 @@ - #!/bin/sh +# +# tor The Onion Router +# +# Startup/shutdown script for tor. This is a wrapper around torctl; +# torctl does the actual work in a relatively system-independent, or at least +# distribution-independent, way, and this script deals with fitting the +# whole thing into the conventions of the particular system at hand. + +# This script is a modified contrb/tor.sh, for use on Slackware. + +TORCTL=/usr/bin/torctl -PIDFILE="/var/lib/tor/tor.pid" - -tor_start() { - echo -n "Starting tor: " - if [ ! -f $PIDFILE ]; then - /usr/bin/tor 1> /dev/null - echo "OK" - else - echo -n "Removing stale lock.. " - rm -f $PIDFILE - /usr/bin/tor 1> /dev/null - echo "OK" - fi -} - -tor_stop() { - echo -n "Stopping tor: " - if [ -f $PIDFILE ]; then - killall tor &> /dev/null - rm -f $PIDFILE - echo "OK" - else - echo "Not Running" - fi -} +# torctl will use these environment variables +TORUSER=tor +export TORUSER case "$1" in - start) - tor_start - ;; - stop) - tor_stop - ;; - restart) - tor_stop - tor_start - ;; - *) - echo "Usage: rc.tor {start|stop|restart}" + + start) + $TORCTL start + ;; + + stop) + $TORCTL stop + ;; + + restart) + $TORCTL restart + ;; + + reload) + $TORCTL reload + ;; + + status) + $TORCTL status + ;; + + *) + echo "Usage: $0 (start|stop|restart|reload|status)" esac |