Script 1:
code is as follows |
copy code |
CAT/R oot/soft_shell/auto_adsl_1.sh #!/bin/bash gateway= ' ifconfig ppp0 |grep p-t-p| cut-f ': "|cut-f 1-d" "' inter= ' Ifconfig |grep Ppp0|awk ' {print $} ' n=2 If [[$inter-eq Ppp0]] then /sbin/adsl-stop Sleep /sbin/adsl-start Sleep pkgloss= ' ping-c4 $gateway |grep ' transm ' |awk-f ', ' {print $} ' |awk ' {print $ 1} ' if [[$pkgloss-lt $N]] then Echo ' Date +%y-%m-%d/%t ' The network is not stable ' >>/root/adsl.txt< br> Else Echo ' Date +%y-%m-%d/%t ' The network is normal ' >>/root/adsl.txt Fi fi |
Script 2:
The code is as follows |
Copy Code |
cat/root/soft_shell/auto_adsl_2.sh #!/bin/bash Gateway= ' ifconfig ppp0 |grep p-t-p| Cut-f ":" |cut-f 1-d "" Inter= ' ifconfig |grep Ppp0|awk ' {print $} ' n=2 if [[$inter!= Ppp0]] Then /sbin/adsl-start Sleep 20 Pkgloss= ' ping-c4 $gateway |grep ' transm ' |awk-f ', ' {print $} ' |awk ' {print '} ' if [[$pkgloss-lt $N]] Then echo "' Date +%y-%m-%d/%t ' The network is not stable" >>/root/adsl.txt Else echo "' Date +%y-%m-%d/%t ' The network is normal" >>/root/adsl.txt Fi Fi |
PS: The purpose of Script 2 is to detect whether ADSL dialing is connected.