summaryrefslogtreecommitdiff
path: root/debian/tor.init
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tor.init')
-rw-r--r--debian/tor.init26
1 files changed, 11 insertions, 15 deletions
diff --git a/debian/tor.init b/debian/tor.init
index 38712ceb7a..29af4d2eec 100644
--- a/debian/tor.init
+++ b/debian/tor.init
@@ -89,6 +89,14 @@ check_torpiddir () {
fi
}
+check_config () {
+ if ! su -s /bin/sh -c "$DAEMON --verify-config" debian-tor > /dev/null; then
+ echo "ABORTED: Tor configuration invalid:" >&2
+ su -s /bin/sh -c "$DAEMON --verify-config" debian-tor >&2
+ exit 1
+ fi
+}
+
case "$1" in
start)
@@ -109,11 +117,7 @@ case "$1" in
check_torpiddir
echo "Starting $DESC: $NAME..."
- if ! su -s /bin/sh -c "$DAEMON --verify-config" debian-tor > /dev/null; then
- echo "ABORTED: Tor configuration invalid:" >&2
- su -s /bin/sh -c "$DAEMON --verify-config" debian-tor >&2
- exit 1
- fi
+ check_config
start-stop-daemon --start --quiet --oknodo \
--pidfile $TORPID \
@@ -149,11 +153,7 @@ case "$1" in
exit 0
fi
- if ! su -s /bin/sh -c "$DAEMON --verify-config" debian-tor > /dev/null; then
- echo "ABORTED: Tor configuration invalid:" >&2
- su -s /bin/sh -c "$DAEMON --verify-config" debian-tor >&2
- exit 1
- fi
+ check_config
if start-stop-daemon --stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON
then
@@ -166,11 +166,7 @@ case "$1" in
fi
;;
restart)
- if ! su -s /bin/sh -c "$DAEMON --verify-config" debian-tor > /dev/null; then
- echo "Restarting Tor ABORTED: Tor configuration invalid:" >&2
- su -s /bin/sh -c "$DAEMON --verify-config" debian-tor >&2
- exit 1
- fi
+ check_config
$0 stop
sleep 1