#!/bin/sh pid() { echo $(ps | awk '/\/usr\/sbin\/openvpn/ { print $5 }') } while [ true ]; do if [ -z "$(pid)" ]; then ifconfig eth0 | grep -q inet\ || udhcpc /etc/init.d/sysntpd start > /dev/null /usr/sbin/openvpn $@ fi sleep 10 done