5 # Startup/shutdown script for tor. This is a wrapper around torctl;
6 # torctl does the actual work in a relatively system-independent, or at least
7 # distribution-independent, way, and this script deals with fitting the
8 # whole thing into the conventions of the particular system at hand.
10 # These next couple of lines "declare" tor for the "chkconfig" program,
11 # originally from SGI, used on Red Hat/Fedora and probably elsewhere.
13 # chkconfig: 2345 90 10
14 # description: Onion Router - A low-latency anonymous proxy
19 # Required-Start: $network
20 # Required-Stop: $network
22 # Default-Stop: 0 1 2 6
23 # Description: Start the tor daemon
28 # Shell functions sourced from /etc/rc.status:
29 # rc_check check and set local and overall rc status
30 # rc_status check and set local and overall rc status
31 # rc_status -v ditto but be verbose in local rc status
32 # rc_status -v -r ditto and clear the local rc status
33 # rc_failed set local and overall rc status to failed
34 # rc_reset clear local rc status (overall remains)
35 # rc_exit exit appropriate to overall rc status
37 # First reset status of this service
40 # Increase open file descriptors a reasonable amount
43 TORCTL
=@BINDIR@
/torctl
45 # torctl will use these environment variables
51 if [ -x /bin
/su
] ; then
53 elif [ -x /sbin
/su
] ; then
55 elif [ -x /usr
/bin
/su
] ; then
57 elif [ -x /usr
/sbin
/su
] ; then
66 echo "Starting tor daemon"
67 ## Start daemon with startproc(8). If this fails
68 ## the echo return value is set appropriate.
70 startproc
-f $TORCTL start
71 # Remember status and be verbose
76 echo "Stopping tor daemon"
77 startproc
-f $TORCTL stop
78 # Remember status and be verbose
83 echo "Restarting tor daemon"
84 startproc
-f $TORCTL restart
85 # Remember status and be verbose
90 echo "Reloading tor daemon"
91 startproc
-f $TORCTL reload
92 # Remember status and be verbose
97 startproc
-f $TORCTL status
98 # Remember status and be verbose
103 echo "Usage: $0 (start|stop|restart|reload|status)"