aboutsummaryrefslogtreecommitdiff
path: root/src/tor
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2012-11-25 20:24:58 (GMT)
committerAdrian C. (anrxc) <anrxc@sysphere.org>2012-11-25 20:24:58 (GMT)
commit16262790cb6ddacf6c632625cc865e03b1b8671f (patch)
tree09898d65deef518380915ecdc7575756c9ca8595 /src/tor
parent7bb1499a7cd539f714bb7f603d7fc0a38fd8a963 (diff)
downloadrcdscripts-16262790cb6ddacf6c632625cc865e03b1b8671f.tar.xz
rcdscripts: import first snapshot of rc.d scripts as of 11.25.20122012.11.25
In 30 days these scripts will start dissapearing from official Arch Linux packages. This is an attempt to conserve them, and keep sysvinit usable.
Diffstat (limited to 'src/tor')
-rwxr-xr-xsrc/tor/tor44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tor/tor b/src/tor/tor
new file mode 100755
index 0000000..522c498
--- /dev/null
+++ b/src/tor/tor
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/tor ] && . /etc/conf.d/tor
+
+PID=`pidof -o %PPID /usr/bin/tor`
+case "$1" in
+ start)
+ stat_busy "Starting Tor Daemon"
+ if [ -z "${TOR_MAX_FD}" ] || ulimit -n "${TOR_MAX_FD}"; then
+ [ -z "$PID" ] && /usr/bin/tor -f ${TOR_CONF} ${TOR_ARGS} &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tor
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Tor Daemon"
+ [ ! -z "$PID" ] && kill -INT $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon tor
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ft=sh ts=2 sw=2