mirror of
https://github.com/edu4rdshl/tor-router.git
synced 2026-07-17 23:24:48 +00:00
Use appropiate exit code when failing
Currently, we use the 0 status code, doesn't matter if it's a failure or not, so lets fix it.
This commit is contained in:
parent
144767ebb2
commit
2fdae488f9
1 changed files with 60 additions and 59 deletions
|
|
@ -9,7 +9,7 @@ case "$1" in
|
||||||
start)
|
start)
|
||||||
if test -f "$RULES"; then
|
if test -f "$RULES"; then
|
||||||
echo "$RULES exists. Either delete it, or stop tor-router first."
|
echo "$RULES exists. Either delete it, or stop tor-router first."
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
iptables-save >$RULES
|
iptables-save >$RULES
|
||||||
# Executable file to create rules for transparent proxy
|
# Executable file to create rules for transparent proxy
|
||||||
|
|
@ -24,18 +24,18 @@ case "$1" in
|
||||||
TOR_UID=$(id -u toranon)
|
TOR_UID=$(id -u toranon)
|
||||||
else
|
else
|
||||||
echo "Unknown distro, please create report the issue to https://github.com/edu4rdshl/tor-router/issues"
|
echo "Unknown distro, please create report the issue to https://github.com/edu4rdshl/tor-router/issues"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v tor >/dev/null; then
|
if ! command -v tor >/dev/null; then
|
||||||
echo "You need to install the tor package."
|
echo "You need to install the tor package."
|
||||||
exit
|
exit 1
|
||||||
elif ! systemctl is-active tor.service >/dev/null; then
|
elif ! systemctl is-active tor.service >/dev/null; then
|
||||||
echo "The tor service is not active, please start the tor service before running the script."
|
echo "The tor service is not active, please start the tor service before running the script."
|
||||||
exit
|
exit 1
|
||||||
elif ! command -v iptables >/dev/null; then
|
elif ! command -v iptables >/dev/null; then
|
||||||
echo "You need to install the iptables package."
|
echo "You need to install the iptables package."
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
iptables -F
|
iptables -F
|
||||||
iptables -t nat -F
|
iptables -t nat -F
|
||||||
|
|
@ -76,4 +76,5 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart}"
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue