[check-vpn-from-ovh] Meilleure logique

Ignore-this: c8801b67230ec5f1c9da4d746a3913c0
vpn en route ne signifie pas toujours que komaz.adm ping bien (surtout quand
les deux tunnels sont lances), on va voir si ca arrange les choses

darcs-hash:20120412065733-ddb99-382fc5e1858c7d57795406628413affb9f43a990.gz
This commit is contained in:
Michel Blockelet 2012-04-12 08:57:33 +02:00
parent d715bd72e8
commit 4b01f6acf3

View file

@ -4,10 +4,7 @@ vpn_is_running () {
local pid_file local pid_file
pid_file=/var/run/openvpn.$1.pid pid_file=/var/run/openvpn.$1.pid
if [ -f $pid_file ] && [ -d /proc/$(< $pid_file) ] if [ -f $pid_file ] && [ -d /proc/$(< $pid_file) ]
then if fping komaz.adm.crans.org &> /dev/null then return 0
then return 0
else return 1
fi
else return 1 else return 1
fi fi
} }
@ -32,7 +29,7 @@ vpn_start () {
fi fi
} }
if vpn_is_running komaz; then if vpn_is_running komaz && fping -q komaz.adm.crans.org; then
# Le vpn vers komaz est actif, tout va bien # Le vpn vers komaz est actif, tout va bien
exit 0 exit 0
fi fi
@ -51,7 +48,7 @@ if fping -q komaz.crans.org; then
vpn_start komaz vpn_start komaz
fi fi
if vpn_is_running freebox; then if vpn_is_running freebox && fping -q komaz.adm.crans.org; then
# On ne peut pas atteindre komaz et on passe par la freebox, c'est # On ne peut pas atteindre komaz et on passe par la freebox, c'est
# normal # normal
exit 0 exit 0