summaryrefslogtreecommitdiff
path: root/network/tor/rc.tor
diff options
context:
space:
mode:
authorErik Hanson <erik@slackbuilds.org>2010-05-11 15:01:37 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-11 15:01:37 +0200
commit38ee9adc8bed3fd9d3d4d2328fb0639b3002935f (patch)
tree8b0de1124feb7decb0c7271dc76f6471fc25c85b /network/tor/rc.tor
parent7d81370b4d67036e1696db79a2ee9b8b28295e5f (diff)
downloadslackbuilds-38ee9adc8bed3fd9d3d4d2328fb0639b3002935f.tar.gz
network/tor: Initial import
Diffstat (limited to 'network/tor/rc.tor')
-rw-r--r--network/tor/rc.tor42
1 files changed, 42 insertions, 0 deletions
diff --git a/network/tor/rc.tor b/network/tor/rc.tor
new file mode 100644
index 0000000000..5c2d99eb0a
--- /dev/null
+++ b/network/tor/rc.tor
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+PIDFILE="/var/lib/tor/tor.pid"
+
+tor_start() {
+ echo -n "Starting tor: "
+ if [ ! -f $PIDFILE ]; then
+ /usr/bin/tor 1> /dev/null
+ echo "OK"
+ else
+ echo -n "Removing stale lock.. "
+ rm -f $PIDFILE
+ /usr/bin/tor 1> /dev/null
+ echo "OK"
+ fi
+}
+
+tor_stop() {
+ echo -n "Stopping tor: "
+ if [ -f $PIDFILE ]; then
+ killall tor &> /dev/null
+ rm -f $PIDFILE
+ echo "OK"
+ else
+ echo "Not Running"
+ fi
+}
+
+case "$1" in
+ start)
+ tor_start
+ ;;
+ stop)
+ tor_stop
+ ;;
+ restart)
+ tor_stop
+ tor_start
+ ;;
+ *)
+ echo "Usage: rc.tor {start|stop|restart}"
+esac