3 TORLOC
=/Library
/StartupItems
/Tor
/Tor.loc
5 if [ -f $TORLOC ]; then
6 TORDIR
=`cat /Library/StartupItems/Tor/Tor.loc`
7 if [ "x$TORDIR" = "x" -o ! -d $TORDIR -o ! -x $TORDIR/tor
]; then
14 TORDATA
=$TORDIR/var
/lib
/tor
15 TORPID
=/var
/run
/Tor.pid
19 TORLOG
=/var
/log
/tor.log
21 ## Determine OSX Version
23 if [ -x /usr
/bin
/sw_vers
]; then
24 # This is poor, yet functional. We don't care about the 3rd number in
26 OSVER
=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 | cut -d"." -f1,2`
28 "10.6") ARCH
="universal";;
29 "10.5") ARCH
="universal";;
30 "10.4") ARCH
="universal";;
40 if [ $ARCH != "universal" ]; then
41 export EVENT_NOKQUEUE
=1
53 if [ -f $TORCMD ]; then
54 if pid
=$
(GetPID Tor
); then
57 ConsoleMessage
"Starting Tor Service"
59 # Making sure it is not running (I know it is not a best approarch)
60 killall tor
2>/dev
/null
61 $TORCMD -f "$TORCONF" --runasdaemon 1 --pidfile "$TORPID" --datadirectory "$TORDATA" --user "$TORUSER" --group "$TORGROUP" --log "notice file $TORLOG" &
68 if pid
=$
(GetPID Tor
); then
69 ConsoleMessage
"Stopping Tor Service"
71 # Just for sanity (sometimes necessary.)
72 killall tor
2>/dev
/null
74 ConsoleMessage
"Tor Service not responding."
75 # Just for sanity (sometimes necessary.)
76 killall tor
2>/dev
/null
80 RestartService
() { StopService
; StartService
; }
83 echo "Syntax: tor {start|stop}"