summaryrefslogtreecommitdiff
path: root/debian/tor.init
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2005-08-09 13:11:00 +0000
committerPeter Palfrader <peter@palfrader.org>2005-08-09 13:11:00 +0000
commitc12d81d654faa78dd8863ce802fbdc61838ac7ff (patch)
tree1e589f3d1d055522eb574da3114f6579a1799851 /debian/tor.init
parent4ce34c013ef069d7d744235d471458f7cffcb696 (diff)
downloadtor-c12d81d654faa78dd8863ce802fbdc61838ac7ff.tar.gz
tor-c12d81d654faa78dd8863ce802fbdc61838ac7ff.zip
Merge debian directory from tor-0_1_0-patches to HEAD
svn:r4758
Diffstat (limited to 'debian/tor.init')
-rw-r--r--debian/tor.init31
1 files changed, 20 insertions, 11 deletions
diff --git a/debian/tor.init b/debian/tor.init
index 13a3bbbb78..ce06ecfa79 100644
--- a/debian/tor.init
+++ b/debian/tor.init
@@ -6,7 +6,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/tor
NAME=tor
DESC="tor daemon"
-TORPID=/var/run/tor/tor.pid
+TORPIDDIR=/var/run/tor
+TORPID=$TORPIDDIR/tor.pid
DEFAULTSFILE=/etc/default/$NAME
WAITFORDAEMON=60
ARGS=""
@@ -50,20 +51,26 @@ case "$1" in
if [ "$RUN_DAEMON" != "yes" ]; then
echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
else
- echo "Starting $DESC: $NAME..."
- ulimit -n $MAX_FILEDESCRIPTORS
- start-stop-daemon --start --quiet --oknodo \
- --chuid debian-tor:debian-tor \
- --pidfile $TORPID \
- $NICE \
- --exec $DAEMON -- $ARGS
- echo "done."
+ if test ! -d $TORPIDDIR; then echo "There is no $TORPIDDIR directory." >&2; exit 1
+ elif test ! -x $TORPIDDIR; then echo "Cannot access $TORPIDDIR directory, are you root?" >&2; exit 1;
+ else
+ echo "Starting $DESC: $NAME..."
+ ulimit -n $MAX_FILEDESCRIPTORS || echo "Warn: Could not set ulimit for number of file descriptors." >&2
+ start-stop-daemon --start --quiet --oknodo \
+ --chuid debian-tor:debian-tor \
+ --pidfile $TORPID \
+ $NICE \
+ --exec $DAEMON -- $ARGS
+ echo "done."
+ fi
fi
;;
stop)
echo -n "Stopping $DESC: "
pid=`cat $TORPID 2>/dev/null` || true
- if test ! -f $TORPID -o -z "$pid"
+ if test ! -d $TORPIDDIR; then echo "There is no $TORPIDDIR directory." >&2; exit 1
+ elif test ! -x $TORPIDDIR; then echo "Cannot access $TORPIDDIR directory, are you root?" >&2; exit 1;
+ elif test ! -f $TORPID -o -z "$pid"
then
echo "not running (there is no $TORPID)."
elif start-stop-daemon --stop --signal INT --quiet --pidfile $TORPID --exec $DAEMON
@@ -80,7 +87,9 @@ case "$1" in
reload|force-reload)
echo -n "Reloading $DESC configuration: "
pid=`cat $TORPID 2>/dev/null` || true
- if test ! -f $TORPID -o -z "$pid"
+ if test ! -d $TORPIDDIR; then echo "There is no $TORPIDDIR directory." >&2; exit 1
+ elif test ! -x $TORPIDDIR; then echo "Cannot access $TORPIDDIR directory, are you root?" >&2; exit 1;
+ elif test ! -f $TORPID -o -z "$pid"
then
echo "not running (there is no $TORPID)."
elif start-stop-daemon --stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON