summaryrefslogtreecommitdiff
path: root/debian/tor.init
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-04 12:21:48 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-04 12:21:48 -0400
commite7d2a9b6c4407217780be3a0d0cbb29fd3812cf5 (patch)
tree437fdab02dd55d51d1bb397f48c69ec1918dc974 /debian/tor.init
parentf206209abfc1f98bbbd0be5b6e36fdec6709953d (diff)
downloadtor-e7d2a9b6c4407217780be3a0d0cbb29fd3812cf5.tar.gz
tor-e7d2a9b6c4407217780be3a0d0cbb29fd3812cf5.zip
Remove the debian directory from the main git repository
Once upon a time it made sense to keep all the Debian files in the main Tor distribution, since repeatedly merging them back in was hard. Now that we're on git, that's no longer so. Peter's debian repository at debian/tor.git on our git server has the most recent version of the tor-on-debian packaging stuff, and the versions in our own repository have gotten out of date. Resolves bug #1735.
Diffstat (limited to 'debian/tor.init')
-rw-r--r--debian/tor.init191
1 files changed, 0 insertions, 191 deletions
diff --git a/debian/tor.init b/debian/tor.init
deleted file mode 100644
index b018847c08..0000000000
--- a/debian/tor.init
+++ /dev/null
@@ -1,191 +0,0 @@
-#! /bin/bash
-
-### BEGIN INIT INFO
-# Provides: tor
-# Required-Start: $local_fs $remote_fs $network $named $time
-# Required-Stop: $local_fs $remote_fs $network $named $time
-# Should-Start: $syslog
-# Should-Stop: $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Starts The Onion Router daemon processes
-# Description: Start The Onion Router, a TCP overlay
-# network client that provides anonymous
-# transport.
-### END INIT INFO
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/tor
-NAME=tor
-DESC="tor daemon"
-TORPIDDIR=/var/run/tor
-TORPID=$TORPIDDIR/tor.pid
-DEFAULTSFILE=/etc/default/$NAME
-WAITFORDAEMON=60
-ARGS=""
-# Let's try to figure our some sane defaults:
-if [ -r /proc/sys/fs/file-max ]; then
- system_max=`cat /proc/sys/fs/file-max`
- if [ "$system_max" -gt "80000" ] ; then
- MAX_FILEDESCRIPTORS=32768
- elif [ "$system_max" -gt "40000" ] ; then
- MAX_FILEDESCRIPTORS=16384
- elif [ "$system_max" -gt "10000" ] ; then
- MAX_FILEDESCRIPTORS=8192
- else
- MAX_FILEDESCRIPTORS=1024
- cat << EOF
-
-Warning: Your system has very few filedescriptors available in total.
-
-Maybe you should try raising that by adding 'fs.file-max=100000' to your
-/etc/sysctl.conf file. Feel free to pick any number that you deem appropriate.
-Then run 'sysctl -p'. See /proc/sys/fs/file-max for the current value, and
-file-nr in the same directory for how many of those are used at the moment.
-
-EOF
- fi
-else
- MAX_FILEDESCRIPTORS=8192
-fi
-
-NICE=""
-
-test -x $DAEMON || exit 0
-
-# Include tor defaults if available
-if [ -f $DEFAULTSFILE ] ; then
- . $DEFAULTSFILE
-fi
-
-wait_for_deaddaemon () {
- pid=$1
- sleep 1
- if test -n "$pid"
- then
- if kill -0 $pid 2>/dev/null
- then
- echo -n "."
- cnt=0
- while kill -0 $pid 2>/dev/null
- do
- cnt=`expr $cnt + 1`
- if [ $cnt -gt $WAITFORDAEMON ]
- then
- echo " FAILED."
- return 1
- fi
- sleep 1
- echo -n "."
- done
- fi
- fi
- return 0
-}
-
-
-check_torpiddir () {
- if test ! -d $TORPIDDIR; then
- #echo "There is no $TORPIDDIR directory. Creating one for you."
- mkdir -m 02700 "$TORPIDDIR"
- chown debian-tor:debian-tor "$TORPIDDIR"
- fi
-
- if test ! -x $TORPIDDIR; then
- echo "Cannot access $TORPIDDIR directory, are you root?" >&2
- exit 1
- fi
-}
-
-check_config () {
- if ! $DAEMON --verify-config > /dev/null; then
- echo "ABORTED: Tor configuration invalid:" >&2
- $DAEMON --verify-config >&2
- exit 1
- fi
-}
-
-
-case "$1" in
- start)
- if [ "$RUN_DAEMON" != "yes" ]; then
- echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
- exit 0
- fi
-
- if [ -n "$MAX_FILEDESCRIPTORS" ]; then
- echo -n "Raising maximum number of filedescriptors (ulimit -n) to $MAX_FILEDESCRIPTORS"
- if ulimit -n "$MAX_FILEDESCRIPTORS" ; then
- echo "."
- else
- echo ": FAILED."
- fi
- fi
-
- check_torpiddir
-
- echo "Starting $DESC: $NAME..."
- check_config
-
- start-stop-daemon --start --quiet --oknodo \
- --pidfile $TORPID \
- $NICE \
- --exec $DAEMON -- $ARGS
- echo "done."
- ;;
- stop)
- echo -n "Stopping $DESC: "
- pid=`cat $TORPID 2>/dev/null` || true
-
- if test ! -f $TORPID -o -z "$pid"; then
- echo "not running (there is no $TORPID)."
- exit 0
- fi
-
- if start-stop-daemon --stop --signal INT --quiet --pidfile $TORPID --exec $DAEMON; then
- wait_for_deaddaemon $pid
- echo "$NAME."
- elif kill -0 $pid 2>/dev/null
- then
- echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
- else
- echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
- fi
- ;;
- reload|force-reload)
- echo -n "Reloading $DESC configuration: "
- pid=`cat $TORPID 2>/dev/null` || true
-
- if test ! -f $TORPID -o -z "$pid"; then
- echo "not running (there is no $TORPID)."
- exit 0
- fi
-
- check_config
-
- if start-stop-daemon --stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON
- then
- echo "$NAME."
- elif kill -0 $pid 2>/dev/null
- then
- echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
- else
- echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
- fi
- ;;
- restart)
- check_config
-
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0