3 # Copyright (c) 2006-2007 Andrew Lewman
7 # Startup/shutdown script for tor. This is a wrapper around torctl;
8 # torctl does the actual work in a relatively system-independent, or at least
9 # distribution-independent, way, and this script deals with fitting the
10 # whole thing into the conventions of the particular system at hand.
12 # These next couple of lines "declare" tor for the "chkconfig" program,
13 # originally from SGI, used on Red Hat/Fedora and probably elsewhere.
15 # chkconfig: 2345 90 10
16 # description: Onion Router - A low-latency anonymous proxy
21 # Required-Start: $remote_fs $network
22 # Required-Stop: $remote_fs $network
24 # Default-Stop: 0 1 2 6
25 # Short-Description: Start the tor daemon
26 # Description: Start the tor daemon: the anon-proxy server
31 # Shell functions sourced from /etc/rc.status:
32 # rc_check check and set local and overall rc status
33 # rc_status check and set local and overall rc status
34 # rc_status -v ditto but be verbose in local rc status
35 # rc_status -v -r ditto and clear the local rc status
36 # rc_failed set local and overall rc status to failed
37 # rc_reset clear local rc status (overall remains)
38 # rc_exit exit appropriate to overall rc status
40 # First reset status of this service
43 # Increase open file descriptors a reasonable amount
46 TORCTL
=@BINDIR@
/torctl
48 # torctl will use these environment variables
54 if [ -x /bin
/su
] ; then
56 elif [ -x /sbin
/su
] ; then
58 elif [ -x /usr
/bin
/su
] ; then
60 elif [ -x /usr
/sbin
/su
] ; then
69 echo "Starting tor daemon"
70 ## Start daemon with startproc(8). If this fails
71 ## the echo return value is set appropriate.
73 startproc
-f $TORCTL start
74 # Remember status and be verbose
79 echo "Stopping tor daemon"
80 startproc
-f $TORCTL stop
81 # Remember status and be verbose
86 echo "Restarting tor daemon"
87 startproc
-f $TORCTL restart
88 # Remember status and be verbose
93 echo "Reloading tor daemon"
94 startproc
-f $TORCTL reload
95 # Remember status and be verbose
100 startproc
-f $TORCTL status
101 # Remember status and be verbose
106 echo "Usage: $0 (start|stop|restart|reload|status)"