more changes. i'm all caught up now.
[tor.git] / contrib / suse / tor.sh.in
blob4afb60dcc6eec8e38345b18dd6e04cfd86b0f9ef
1 #!/bin/sh
3 # tor The Onion Router
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
17 ### BEGIN INIT INFO
18 # Provides: tor
19 # Required-Start: $network
20 # Required-Stop: $network
21 # Default-Start: 3 5
22 # Default-Stop: 0 1 2 6
23 # Description: Start the tor daemon
24 ### END INIT INFO
26 . /etc/rc.status
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
38 rc_reset
40 # Increase open file descriptors a reasonable amount
41 ulimit -n 8192
43 TORCTL=@BINDIR@/torctl
45 # torctl will use these environment variables
46 TORUSER=@TORUSER@
47 export TORUSER
48 TORGROUP=@TORGROUP@
49 export TORGROUP
51 if [ -x /bin/su ] ; then
52 SUPROG=/bin/su
53 elif [ -x /sbin/su ] ; then
54 SUPROG=/sbin/su
55 elif [ -x /usr/bin/su ] ; then
56 SUPROG=/usr/bin/su
57 elif [ -x /usr/sbin/su ] ; then
58 SUPROG=/usr/sbin/su
59 else
60 SUPROG=/bin/su
63 case "$1" in
65 start)
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
72 rc_status -v
75 stop)
76 echo "Stopping tor daemon"
77 startproc -f $TORCTL stop
78 # Remember status and be verbose
79 rc_status -v
82 restart)
83 echo "Restarting tor daemon"
84 startproc -f $TORCTL restart
85 # Remember status and be verbose
86 rc_status -v
89 reload)
90 echo "Reloading tor daemon"
91 startproc -f $TORCTL reload
92 # Remember status and be verbose
93 rc_status -v
96 status)
97 startproc -f $TORCTL status
98 # Remember status and be verbose
99 rc_status -v
103 echo "Usage: $0 (start|stop|restart|reload|status)"
104 RETVAL=1
105 esac
107 rc_exit