29 lines
927 B
Bash
Executable file
29 lines
927 B
Bash
Executable file
#!/bin/bash
|
|
|
|
VPN_NAME=adm
|
|
PID_FILE=/var/run/openvpn.${VPN_NAME}.pid
|
|
|
|
if [[ ! -f $PID_FILE || ! -d /proc/$(< $PID_FILE) ]]; 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
|