diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-03-01 00:49:03 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-03-01 00:49:03 +0000 |
commit | 0b95e987b195350158b17b5bca999f9cfd9a1124 (patch) | |
tree | 35331b96ec9516bb6f511685b7de89486995bbe9 /debian | |
parent | c5a7ff8e4343886b2d4a5afb7d16d772c664a409 (diff) | |
download | tor-0b95e987b195350158b17b5bca999f9cfd9a1124.tar tor-0b95e987b195350158b17b5bca999f9cfd9a1124.tar.gz |
Move config check to its own function
svn:r13787
Diffstat (limited to 'debian')
-rw-r--r-- | debian/tor.init | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/debian/tor.init b/debian/tor.init index 38712ceb7..29af4d2ee 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 |