diff options
author | Steven Hazel <sah@freehaven.net> | 2003-10-15 07:19:38 +0000 |
---|---|---|
committer | Steven Hazel <sah@freehaven.net> | 2003-10-15 07:19:38 +0000 |
commit | a54a65dfb68b41bf86c5d3e72f33beb6773c6983 (patch) | |
tree | 722f7717e186ce2d17b5d05b817e62239b3916b5 /tor.sh.in | |
parent | 0149c4ed555db821e9331f1925fae46638a30f46 (diff) | |
download | tor-a54a65dfb68b41bf86c5d3e72f33beb6773c6983.tar.gz tor-a54a65dfb68b41bf86c5d3e72f33beb6773c6983.zip |
- cause configure to create a tor.sh which will have directories set
correctly based on how configure was run
- cause tor to guess the location of torrc more intelligently
- cause cause src/config/torrc and src/conf/sample-server-torrc to be
generated with contents that are correct for the way configure was
run
- cause "make install" to put torrc, sample-server-torrc, and
dirservers somewhere intelligent
svn:r587
Diffstat (limited to 'tor.sh.in')
-rw-r--r-- | tor.sh.in | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tor.sh.in b/tor.sh.in new file mode 100644 index 0000000000..37e338f4d2 --- /dev/null +++ b/tor.sh.in @@ -0,0 +1,75 @@ +#! /bin/sh + +TORBIN=@BINDIR@/tor +TORPID=@LOCALSTATEDIR@/run/tor.pid +TORLOG=@LOCALSTATEDIR@/log/tor/tor.log +TORCONF=@CONFDIR@/torrc +RETVAL=0 + +case "$1" in + + start) + if [ -f $TORPID ]; then + echo "tor appears to be already running (pid file exists)" + echo "Maybe you should run: $0 restart ?" + RETVAL=1 + else + echo -n "Starting tor..." + $TORBIN -f $TORCONF -l warning >$TORLOG 2>&1 & + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + echo " ok" + else + echo " ERROR!" + fi + fi + ;; + + stop) + if [ -f $TORPID ]; then + echo -n "Killing tor..." + kill `cat $TORPID` + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + echo " ok" + else + echo " ERROR!" + fi + else + echo "Unable to kill tor: $TORPID does not exist" + RETVAL=1 + fi + ;; + + restart) + $0 stop + if [ -f $TORPID ]; then + rm -f $TORPID + fi + $0 start + ;; + + status) + PID=`cat $TORPID 2>/dev/null` + if [ "$PID" != "" ]; then + torstat=`ps -p $PID | grep -c "^$PID"` + if [ $torstat ]; then + echo "tor is running ($PID)" + else + echo "tor is not running (looks like it crashed, look for core? $PID)" + fi + else + echo "tor is not running (exited gracefully)" + fi + ;; + + log) + cat $TORLOG + ;; + + *) + echo "Usage: $0 (start|stop|restart|status|log)" + exit 1 +esac + +exit $RETVAL |