/[packages]/cauldron/tor/current/SOURCES/tor.init
ViewVC logotype

Contents of /cauldron/tor/current/SOURCES/tor.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 73394 - (show annotations) (download)
Thu Mar 17 19:28:29 2011 UTC (9 years, 11 months ago) by boklm
File size: 2149 byte(s)
imported package tor
1 #!/bin/bash
2 #
3 #tor The Onion Router
4 #
5 # chkconfig: 2345 90 10
6 # description: Onion Router
7 ### BEGIN INIT INFO
8 # Provides: tor
9 # Should-Start: $network
10 # Should-Stop: $network
11 # Default-Start: 2 3 4 5
12 # Short-Description: The Onion Router
13 # Description: The Onion Router.
14 ### END INIT INFO
15
16 TORUSER=toruser
17 TORBIN=/usr/bin/tor
18 TORPID=/var/run/tor/tor.pid
19 TORLOG=/var/log/tor/tor.log
20 TORDATA=/var/lib/tor
21
22 TORCONF=/etc/tor/torrc
23
24 # Source function library.
25 . /etc/rc.d/init.d/functions
26
27 # Source networking configuration.
28 . /etc/sysconfig/network
29
30 [ -r /etc/sysconfig/tor ] && . /etc/sysconfig/tor
31
32 # Check that networking is up.
33 [ ${NETWORKING} = "no" ] && exit 0
34
35 TORARGS="PIDFile $TORPID Log \"notice file $TORLOG\" RunAsDaemon 1 DataDirectory $TORDATA User $TORUSER"
36
37 RETVAL=0
38
39 # See how we were called.
40 case "$1" in
41 start)
42 gprintf "Starting %s:" tor
43 if [ -f $TORPID ]; then
44 failure "tor appears to be already running (pid file exists)"
45 exit 1
46 fi
47 daemon $TORBIN -f $TORCONF $TORARGS
48 RETVAL=$?
49 if [ "$RETVAL" = 0 ]; then
50 success "%s startup" tor
51 touch /var/lock/subsys/tor
52 else
53 failure "%s startup" tor
54 fi
55 echo
56 ;;
57 stop)
58 gprintf "Stopping %s:" tor
59 if [ -f $TORPID ]; then
60 kill `cat $TORPID`
61 RETVAL=$?
62 if [ "$RETVAL" = 0 ]; then
63 success "%s shutdown" tor
64 rm -f /var/lock/subsys/tor
65 else
66 failure "%s shutdown" tor
67 fi
68 else
69 success "%s is not running" tor
70 RETVAL=0
71 fi
72 echo
73 ;;
74 status)
75 status tor
76 ;;
77 restart)
78 $0 stop
79 $0 start
80 ;;
81 reload)
82 gprintf "Reloading %s:" tor
83 if [ -f $TORPID ]; then
84 gprintf "Sending HUP to tor: "
85 kill -HUP `cat $TORPID`
86 RETVAL=$?
87 [ "$RETVAL" = 0 ] && success "config reload" || failure "config reload"
88 else
89 failure "%s is not running" tor
90 RETVAL=1
91 fi
92 echo
93 ;;
94 condrestart)
95 if [ -f $TORPID ]; then
96 $0 stop
97 $0 start
98 fi
99 ;;
100 log)
101 cat $TORLOG
102 ;;
103 *)
104 gprintf "Usage: %s {start|stop|restart|reload|status|log}\n" $0
105 exit 1
106 esac
107
108 exit $RETVAL

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.28