#!/bin/sh -x VLANLIST="vlan542 vlan666" PING="/sbin/ping" AWK="/usr/bin/awk" GREP="/usr/bin/grep" COUNT="10" IFCONFIG="/sbin/ifconfig" for vlandev in ${VLANLIST} do VLANPARM=`${GREP} ifconfig_${vlandev} /etc/rc.conf` if [ -n "${VLANPARM}" ]; then MYIP=`echo ${VLANPARM}|${AWK} '{print $2}'` VLANCONF=`echo ${VLANPARM}|${AWK} -F\" '{print $2}'` ALIVE=`${PING} -q -i 0.1 -c ${COUNT} ${MYIP}` echo ${ALIVE} | grep "100.0% packet loss" if [ $? = "0" ]; then ${IFCONFIG} ${vlandev} create && ${IFCONFIG} ${vlandev} ${VLANCONF} # echo "Creating ${vlandev} having configuration ${VLANCONF}..." fi fi done