28 lines
895 B
Bash
Executable file
28 lines
895 B
Bash
Executable file
#!/bin/sh
|
|
|
|
VPN_NAME=adm
|
|
|
|
if { ! ps -p $(< /var/run/openvpn.${VPN_NAME}.pid) > /dev/null; }; then
|
|
if fping -q komaz.crans.org; then
|
|
ln -sf komaz.conf /etc/openvpn/${VPN_NAME}.conf
|
|
if /etc/init.d/openvpn start ${VPN_NAME} > /dev/null; then
|
|
echo "Lancement du tunnel vers komaz reussi !"
|
|
exit 0
|
|
else
|
|
echo "Echec du lancement du tunnel vers komaz !"
|
|
exit 1
|
|
fi
|
|
elif fping -q freebox.crans.org; then
|
|
ln -sf freebox.conf /etc/openvpn/${VPN_NAME}.conf
|
|
if /etc/init.d/openvpn start ${VPN_NAME} > /dev/null; then
|
|
echo "Lancement du tunnel vers freebox reussi !"
|
|
exit 0
|
|
else
|
|
echo "Echec du lancement du tunnel vers freebox !"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Impossible de determiner un point d'acces au CRANS !"
|
|
exit 1
|
|
fi
|
|
fi
|