
- Remplacement du test avec ps qui est trop verbeux quand le fichier de pid n'existe pas - Echapement correct des «!» darcs-hash:20080106221328-af139-42c198fcead8374604735ea60adf979b911554c1.gz
29 lines
923 B
Bash
Executable file
29 lines
923 B
Bash
Executable file
#!/bin/sh
|
|
|
|
VPN_NAME=adm
|
|
PID_FILE=/var/run/openvpn.${VPN_NAME}.pid
|
|
|
|
if [ ! -f $PID_FILE -o ! -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
|