*** /etc/init.d/openvpn.orig 2005-07-10 18:26:41.000000000 +0200 --- /etc/init.d/openvpn 2005-07-10 18:38:08.000000000 +0200 *************** *** 34,42 **** --- 34,59 ---- --startas /usr/sbin/openvpn -- --config ${VPN}/local.conf \ --writepid /var/run/openvpn-${VPN}.pid \ --daemon --cd ${VPN} + COMPLETELYUP=1 #not tested so not completly up eend $? else einfo "Connection ${VPN} already online. Skipping..." + COMPLETELYUP=0 #already up and tested + fi + + CONNECTIONTESTS=0 #this var contains the number of times the connection has been tested + while [[ ${COMPLETELYUP} -gt 0 ]] && [[ ${CONNECTIONTESTS} -lt 5 ]]; do # after 5 tests I give up + if [ -f ${VPN}/onlinecheck ]; then + ping -c 3 `head -n 1 ${VPN}/onlinecheck` >& /dev/null + COMPLETELYUP=$? + CONNECTIONTESTS=`expr ${CONNECTIONTEST} + 1` + else + COMPLETELYUP=`true` + fi + done + if [[ ${COMPLETELYUP} -gt 0 ]]; then + ewarn "Openvpn started without problems but the host in" + ewarn "${VPN}/onlinecheck is unavailable." fi else ewarn "Expected ${VPNDIR}/${VPN} to be a directory containing a local.conf."