Always nul-terminate the result passed to evdns_server_add_ptr_reply
[tor/rransom.git] / contrib / tor.sh.in
blobe169761a628bdd5638d55ecc569b9f05900f13e0
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.
9 # This particular script is written for Red Hat/Fedora Linux, and may
10 # also work on Mandrake, but not SuSE.
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 # Library functions
20 if [ -f /etc/rc.d/init.d/functions ]; then
21 . /etc/rc.d/init.d/functions
22 elif [ -f /etc/init.d/functions ]; then
23 . /etc/init.d/functions
26 # Increase open file descriptors a reasonable amount
27 ulimit -n 8192
29 TORCTL=@BINDIR@/torctl
31 # torctl will use these environment variables
32 TORUSER=@TORUSER@
33 export TORUSER
35 if [ -x /bin/su ] ; then
36 SUPROG=/bin/su
37 elif [ -x /sbin/su ] ; then
38 SUPROG=/sbin/su
39 elif [ -x /usr/bin/su ] ; then
40 SUPROG=/usr/bin/su
41 elif [ -x /usr/sbin/su ] ; then
42 SUPROG=/usr/sbin/su
43 else
44 SUPROG=/bin/su
47 case "$1" in
49 start)
50 action $"Starting tor:" $TORCTL start
51 RETVAL=$?
54 stop)
55 action $"Stopping tor:" $TORCTL stop
56 RETVAL=$?
59 restart)
60 action $"Restarting tor:" $TORCTL restart
61 RETVAL=$?
64 reload)
65 action $"Reloading tor:" $TORCTL reload
66 RETVAL=$?
69 status)
70 $TORCTL status
71 RETVAL=$?
75 echo "Usage: $0 (start|stop|restart|reload|status)"
76 RETVAL=1
77 esac
79 exit $RETVAL