Make fix-routes not terminate with status 2 if it fixed it

This will make openvpn think something went wrong and terminate the connection.
I did this to make it easily visible when running with ansible, but in this case
it messes things up.

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2015-10-23 02:41:01 +00:00
parent d5bdc65887
commit 50511a65e7

View file

@ -8,5 +8,5 @@ then
# 2. Add a new route to 192.168.0.0/16 via that IP addres (from xargs on)
# 3. Print "Fixed VPN" and exit with code 2 to indicate that it changed
# Note: I've been told that the grep and awk can be in one command, and I believe that, but I find this clearer.
(ip route show | grep '192.168.0.0/16') || ((ip route show | grep '192.168.0.' | awk '{print $1}' | xargs ip route add 192.168.0.0/16 via) && echo "Fixed VPN" && exit 2);
(ip route show | grep '192.168.0.0/16') || ((ip route show | grep '192.168.0.' | awk '{print $1}' | xargs ip route add 192.168.0.0/16 via) && echo "Fixed VPN");
fi