[or-cvs] r13787: Move config check to its own function (tor/trunk/debian)
weasel at seul.org
weasel at seul.org
Sat Mar 1 00:49:03 UTC 2008
Author: weasel
Date: 2008-02-29 19:49:03 -0500 (Fri, 29 Feb 2008)
New Revision: 13787
Modified:
tor/trunk/debian/tor.init
Log:
Move config check to its own function
Modified: tor/trunk/debian/tor.init
===================================================================
--- tor/trunk/debian/tor.init 2008-02-29 14:56:37 UTC (rev 13786)
+++ tor/trunk/debian/tor.init 2008-03-01 00:49:03 UTC (rev 13787)
@@ -89,7 +89,15 @@
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)
if [ "$RUN_DAEMON" != "yes" ]; then
@@ -109,11 +117,7 @@
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 @@
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 @@
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
More information about the tor-commits
mailing list