So-Net撥接固定IP有時侯會撥到別的IP,此Script是判斷如果IP不是原本那個,就再重撥.
#!/bin/bash
checkip=`/sbin/ifconfig ppp0 grep 'inet addr' sed 's/^.*addr://g' | sed 's/ P-t-P.*$//g'`
if [ "$checkip" != "你的固定IP" ];
then
/usr/sbin/pppoe-stop
/usr/sbin/pppoe-start
sleep 10
if !(cat /proc/net/dev | grep ppp0) > /dev/null 2>&1
then
/usr/sbin/pppoe-stop
/usr/sbin/pppoe-start
fi
fi
#!/bin/bash
checkip=`/sbin/ifconfig ppp0 grep 'inet addr' sed 's/^.*addr://g' | sed 's/ P-t-P.*$//g'`
if [ "$checkip" != "你的固定IP" ];
then
/usr/sbin/pppoe-stop
/usr/sbin/pppoe-start
sleep 10
if !(cat /proc/net/dev | grep ppp0) > /dev/null 2>&1
then
/usr/sbin/pppoe-stop
/usr/sbin/pppoe-start
fi
fi
全站熱搜
留言列表