Bienvenue sur eagle-usb

EagleDev

TestConnec1

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes 2600:1f28:365:80b0:68d0:b4fa:fc52:b6b4

#! /bin/bash
# http://forum.eagle-usb.org/viewtopic.php?p=15002#15002
# http://alainmuchembled.free.fr/adsld
# Author : alainmuchembled at free dot fr aka JM jm at jm10 dot no-ip dot com
# licence : GPL
# location : /etc/rcS.d/S99adsld -> /etc/init.d/adsld

usage() { echo "Usage: $0 {start|stop|restart}"; }

PATH=/bin:/usr/local/sbin:/usr/bin:/sbin
pid=/var/run/adsld.pid

if [ -r $pid ]
then case $1 in
  1. set `< $pid`; rm $pid; pkill -P $1 sleep;;
  2. pkill -P `< $pid` sleep;;
  3. echo "$0 already running";;*) usage
esac
else case $1 in
stop|restart) echo "$0 not running";;
  • (
    diag() {
    for cmd in 'sort /proc/net/ip_conntrack' \
    'netstat -anp' \
    'ps f -eo user,group,pmem,bsdstart,time,nice,pcpu,pid,command' \
    eaglestat \
    w \
    'route -n' \
    'tail /var/log/kern.log'
    do echo "# $cmd"; $cmd; echo
    done | mail root -s "Can't ping $i - $1..."
    }

    pause() { sleep $1m; set $?; [ -r $pid ] || exit; return $1; }

    while :; do
    while ! i=`eaglectrl -i`
    do pause 1
    done

    if eaglestat | grep operational; then
    startadsl
    i=$(route -n | sed -n "s/^0\.0\.0\.0 \+\([^ ]\+\).\+$i\$/\1/p")

    while pause 8; do
    ping -c 1 $i && continue
    diag 'ping failed'
    pause 1 || break
    ping -c 1 $i && continue
    pause 1 || break
    ping -c 1 $i && continue
    diag 'rebooting modem'
    break
    done

    stopadsl
    fi
    eaglectrl -w
    done) &> /dev/null & echo -n $! > $pid;;
    *) usage;;
    esac
    fi
    Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]