Think before you speak, read before you think.

在ubuntu下自动pppoe拨号

原理是当网络不通时,自动拨号

#!/bin/bash
#This program dial via pppoe
#History jpuyy 2011/01/20
# add ip / hostname separated by white space

HOSTS="g.cn"

# no ping request

COUNT=1

for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [[ $count -eq 0 ]]; then
# 100% failed
poff
pon dsl-provider
fi
done

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *