Issues with router_get_by_nickname() (3)
[tor/rransom.git] / contrib / suse / tor.sh.in
blob5dad6499b9d1f0f69578b411a6f96e8307ebdc30
1 #!/bin/sh
3 # Copyright (c) 2006-2007 Andrew Lewman
5 # tor The Onion Router
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
19 ### BEGIN INIT INFO
20 # Provides: tor
21 # Required-Start: $remote_fs $network
22 # Required-Stop: $remote_fs $network
23 # Default-Start: 3 5
24 # Default-Stop: 0 1 2 6
25 # Short-Description: Start the tor daemon
26 # Description: Start the tor daemon: the anon-proxy server
27 ### END INIT INFO
29 . /etc/rc.status
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
41 rc_reset
43 # Increase open file descriptors a reasonable amount
44 ulimit -n 8192
46 TORCTL=@BINDIR@/torctl
48 # torctl will use these environment variables
49 TORUSER=@TORUSER@
50 export TORUSER
51 TORGROUP=@TORGROUP@
52 export TORGROUP
54 if [ -x /bin/su ] ; then
55 SUPROG=/bin/su
56 elif [ -x /sbin/su ] ; then
57 SUPROG=/sbin/su
58 elif [ -x /usr/bin/su ] ; then
59 SUPROG=/usr/bin/su
60 elif [ -x /usr/sbin/su ] ; then
61 SUPROG=/usr/sbin/su
62 else
63 SUPROG=/bin/su
66 case "$1" in
68 start)
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
75 rc_status -v
78 stop)
79 echo "Stopping tor daemon"
80 startproc -f $TORCTL stop
81 # Remember status and be verbose
82 rc_status -v
85 restart)
86 echo "Restarting tor daemon"
87 startproc -f $TORCTL restart
88 # Remember status and be verbose
89 rc_status -v
92 reload)
93 echo "Reloading tor daemon"
94 startproc -f $TORCTL reload
95 # Remember status and be verbose
96 rc_status -v
99 status)
100 startproc -f $TORCTL status
101 # Remember status and be verbose
102 rc_status -v
106 echo "Usage: $0 (start|stop|restart|reload|status)"
107 RETVAL=1
108 esac
110 rc_exit