Hello KnuX,
> Voici mon probl�me :
> - Je cherche � pouvoir reconnecter automatiquement ma machine � Internet
> lorsqu'elle n'y est pas (donc au d�marrage et apr�s des plantages pour une
> raison X ou Y de cette connexion).
For automatic reconnection I use a cron job that checks whether ppp0 is
still up and/or if there are USBDEVFS_BULK fails. Note that I reload the
USB modules to achieve this, so if you are using other USB devices this
might not be an ideal solution.
To start the connection I just run /etc/ppp/peers/runadsl, which is a
variant of runadslclean that doesn't check for stale runfiles etc. You can
use runadslclean for this. Note that the script uses Red Hat specific
/etc/rc.d/init.d/functions.
[EMAIL PROTECTED] root]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.9499 installed on Sat Oct 18 01:51:59 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0-59/5 * * * * /root/bin/checkadsl
[EMAIL PROTECTED] root]# cat /root/bin/checkadsl
#!/bin/sh
RELOADLOG="/var/log/adsl_reload"
# Generate a packet so a USBDEVFS_BULK fail message gets syslogged
ping -c 1 -t 1 123.45.67.89
devfail=$(/sbin/ifconfig ppp0 2>&1 | grep Device\ not\ found)
usbfail=$(tail /var/log/messages | grep USBDEVFS_BULK\ failed)
if [ "$usbfail" != "" ] || [ "$devfail" != "" ]; then
/sbin/rmmod usb-uhci #> /dev/null 2>&1
sleep 1
/sbin/modprobe usb-uhci #> /dev/null 2>&1
sleep 3
/etc/ppp/peers/runadslclean
echo -n "Last ADSL reload on " >> $RELOADLOG
date >> $RELOADLOG
fi
[EMAIL PROTECTED] root]# cat /etc/ppp/peers/runadslclean
#!/bin/sh
. /etc/rc.d/init.d/functions
LOCKFILE="/etc/ppp/peers/adsl.lock"
FIRMWARE="/etc/ppp/firmware/KQD6P2.eni"
if [ -f ${LOCKFILE} ]; then
echo "Other process already starting ADSL"
exit
fi
touch ${LOCKFILE}
echo -n "Removing stale run file"
rm -f /var/run/pppoa3-modem1.pid
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo_success
else
echo_failure
fi
echo
echo -n "Killing pppoa3 instances"
ps wax | grep pppoa3 | grep -v grep | cut -b 1-5 | xargs -i kill -KILL {}
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo_success
else
echo_failure
fi
echo
echo -n "Loading firmware for USB modem"
/usr/sbin/modem_run -v 0 -s -f $FIRMWARE
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo_success
else
echo_failure
fi
echo
echo -n "Setting up ADSL connection"
/usr/sbin/pppd call adsl
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo_success
else
echo_failure
echo
exit 1
fi
echo
echo -n "Copying /etc/ppp/resolv.conf to /etc/resolv.conf"
cp /etc/ppp/resolv.conf /etc/resolv.conf
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo_success
else
echo_failure
fi
echo
#/etc/ppp/peers/firewall
rm -f ${LOCKFILE}
Hope this is of any use to you.
Bye,
Leonard.
--
How clean is a war when you shoot around nukelar waste?
Stop the use of depleted uranium ammo!
End all weapons of mass destruction.
Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se d�sinscrire : mailto:[EMAIL PROTECTED]