| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | #!/bin/shTORCONF=/Library/Tor/torrcTORDIR=/Library/Tor/var/lib/torTORPID=/var/run/Tor.pidTORUSER=_torTORGROUP=daemonTORCMD=/Library/Tor/tor### Tor Service##. /etc/rc.commonStartService (){    if [ -f $TORCMD ]; then        if pid=$(GetPID Tor); then            return 0        else		ConsoleMessage "Starting Tor Service"# Tentative# Making sure it is not running (I know it is not a best approarch)		killall tor 2>/dev/null		$TORCMD -f $TORCONF --runasdaemon 1 --pidfile $TORPID --datadirectory $TORDIR --user $TORUSER --group $TORGROUP &	fi    fi}StopService (){    if pid=$(GetPID Tor); then	ConsoleMessage "Stopping Tor Service"	kill -TERM "${pid}"# Just for sanity (sometimes necessary.)	killall tor 2>/dev/null    else	ConsoleMessage "Tor Service not responding."# Just for sanity (sometimes necessary.)	killall tor 2>/dev/null    fi}RestartService () { StopService; StartService; }RunService "$1"
 |