mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 02:09:24 +01:00
Move config check to its own function
svn:r13787
This commit is contained in:
parent
c5a7ff8e43
commit
0b95e987b1
26
debian/tor.init
vendored
26
debian/tor.init
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user