#!/bin/shGET_PPP_GATEWAY() { iface=$1 echo "iface="$iface PPP_IP=$(ifconfig $iface|grep "inet addr"|awk -F ":" '{print $2}'|awk -F " " '{print $1}') PPP_GATEWAY=$PPP_IP}sleep 300Hour=$(date +%H)WAN1_IF=$(nvram get wan_iface)WAN2_IF=$(nvram get wan2_iface)WAN3_IF=$(nvram get wan3_iface)WAN4_IF=$(nvram get wan4_iface)if [[ "$WAN1_IF" == "" ] || [ "$WAN2_IF" == "" ] || [ "$WAN3_IF" == "" ]] && [ "$Hour" == "05" ] ; then rebootelse GET_PPP_GATEWAY $WAN1_IF if [ "$PPP_IP" == "" ] && [ "$Hour" == "05" ] ; then reboot exit fi GET_PPP_GATEWAY $WAN2_IF if [ "$PPP_IP" == "" ] && [ "$Hour" == "05" ] ; then reboot exit fi GET_PPP_GATEWAY $WAN3_IF if [ "$PPP_IP" == "" ] && [ "$Hour" == "05" ] ; then reboot exit fi echo "X_WAN ok"fi
#以下是四拨号允许两个拨号成功就不自动重启#自动重启有次数限制,次数存放在NVRAM#Powered by HeliXZz (c)2012#!/bin/shGET_PPP_GATEWAY() { iface=$1 echo "iface="$iface PPP_IP=$(ifconfig $iface|grep "inet addr"|awk -F ":" '{print $2}'|awk -F " " '{print $1}') PPP_GATEWAY=$PPP_IP}FAST_REBOOT() { service wan stop sleep 15 kill -SIGHUP 1}sleep 35TOTALNUM=4WAN1_IF=$(nvram get wan_iface)WAN2_IF=$(nvram get wan2_iface)WAN3_IF=$(nvram get wan3_iface)WAN4_IF=$(nvram get wan4_iface)GET_PPP_GATEWAY $WAN1_IFif [ "$PPP_IP" == "" ]; then let TOTALNUM=$TOTALNUM-1fiGET_PPP_GATEWAY $WAN2_IFif [ "$PPP_IP" == "" ]; then let TOTALNUM=$TOTALNUM-1fiGET_PPP_GATEWAY $WAN3_IFif [ "$PPP_IP" == "" ]; then let TOTALNUM=$TOTALNUM-1fiGET_PPP_GATEWAY $WAN4_IFif [ "$PPP_IP" == "" ]; then let TOTALNUM=$TOTALNUM-1fiif [ $TOTALNUM -lt 3 ]; then if [ $(nvram get multiwan_retry_count) -lt 1 ]; then nvram set multiwan_retry_count=5 FAST_REBOOT else RETRY_COUNT=$(nvram get multiwan_retry_count) let RETRY_COUNT=$RETRY_COUNT-1 nvram set multiwan_retry_count=$RETRY_COUNT FAST_REBOOT fi exitelseecho $TOTALNUM+"WAN ok"nvram set multiwan_retry_count=5fi