summaryrefslogtreecommitdiff
path: root/debian/tor.init
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2004-01-13 13:40:00 +0000
committerPeter Palfrader <peter@palfrader.org>2004-01-13 13:40:00 +0000
commit9d3cf1b4d1884d7f7e0ea39bc9fe8eae481647a2 (patch)
treef8abee2a51977b150260bfb7699a4c94b6bc6bb7 /debian/tor.init
parent793c65e60fa0cf4be6cde6b6011d12291e92a969 (diff)
downloadtor-9d3cf1b4d1884d7f7e0ea39bc9fe8eae481647a2.tar.gz
tor-9d3cf1b4d1884d7f7e0ea39bc9fe8eae481647a2.zip
First go at a debian package
svn:r987
Diffstat (limited to 'debian/tor.init')
-rw-r--r--debian/tor.init55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/tor.init b/debian/tor.init
new file mode 100644
index 0000000000..2a037ee5ae
--- /dev/null
+++ b/debian/tor.init
@@ -0,0 +1,55 @@
+#! /bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/tor
+NAME=tor
+DESC="tor daemon"
+TORLOG=/var/log/tor/log
+TORPID=/var/run/tor/tor.pid
+ARGS="--pidfile $TORPID --logfile $TORLOG --runasdaemon 1"
+
+test -x $DAEMON || exit 0
+
+# Include tor defaults if available
+if [ -f /etc/default/tor ] ; then
+ . /etc/default/tor
+fi
+
+set -e
+
+case "$1" in
+ start)
+ if [ "$RUN_DAEMON" != "yes" ]; then
+ echo "Not starting $DESC (Disabled in /etc/default/tor)."
+ else
+ echo -n "Starting $DESC: "
+ start-stop-daemon --start --quiet --oknodo \
+ --chuid debian-tor:debian-tor \
+ --pidfile $TORPID \
+ --exec $DAEMON -- $ARGS
+ echo "$NAME."
+ fi
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ start-stop-daemon --stop --quiet --oknodo --pidfile $TORPID \
+ --exec $DAEMON
+ echo "$NAME."
+ ;;
+ reload|force-reload)
+ echo "Reloading $DESC configuration."
+ start-stop-daemon --stop --signal 1 --oknodo --quiet --pidfile $TORPID \
+ --exec $DAEMON
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0