Différences

Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.

ppp.sh [2010/08/06 12:57] (Version actuelle)
Ligne 1: Ligne 1:
 +<code>
  
 +#!/bin/bash
 +
 +#SERVERS="62.4.16.36 feth1-0-thevenin.nerim.net www.nerim.net hsrp1-telehouse.nerim.net feth0-0-julo.nerim.net"
 +SERVERS2=irc.geeknode.org
 +STATUS_LINK=0
 +
 +USER=`id -u`
 +
 +if [ ! "$USER" = "0" ];
 +then
 +  echo "you're not root, you can't check adsl."
 +  exit
 +fi
 +
 +if [ -f /var/run/checkadsl ]
 +then
 +  echo already running
 +  exit
 +fi
 +
 +if ! /sbin/ifconfig ppp0 > /dev/null
 +then
 +  echo "No pppd running. Restarting NOW."
 +  killall pppd
 +  /etc/init.d/net.ppp0 restart  
 +  exit                          
 +fi                              
 +                                
 +touch /var/run/checkadsl        
 +                                
 +## recupere l'ip du peer        
 +ip=$(/sbin/ifconfig  ppp0 | /bin/grep "P-t-P" | /usr/bin/cut -d":" -f3 | /usr/bin/cut -d" " -f1)
 +SERVERS=$ip                     
 +                                
 +for i in $SERVERS;              
 +do                              
 +  ping -c 3 $i                  
 +#1>/dev/null 2>/dev/null        
 +  if [ "$?" = "0" ];            
 +  then                          
 +    STATUS_LINK=1               
 +    rm -f /var/run/checkadsl    
 +    echo "exit c est ok on passe au deuxieme test"
 +  exit 0                        
 +  fi                            
 +done                            
 +if [ "$STATUS_LINK" = "0" ];
 +then
 +  echo "ADSL Link DOWN. Restarting NOW."
 +
 +  /etc/init.d/net.ppp0 restart
 +  rm -f /var/run/checkadsl
 +fi
 +
 +rm -f /var/run/checkadsl
 +</code>
 
ppp.sh.txt · Dernière modification: 2010/08/06 12:57 (modification externe)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki