Bonsoir � tous.
une question me tracasse: l'arr�t propre de la connexion. Propre car je
veux conserver mon USB utilisable et pouvoir relancer une autre connexion
plus tard.
Dans la plupart des scripts disponibles sur le forum, on revient quasiment
toujours � la s�quence :
kill pid_pppoeci
kill pid_pppd
puis plus tard :
rmmod usb-uhci
modprobe usb-uhci
pour relancer toute la m�canique.
je veux bien pour les kill mais ce qui me d�range le plus c'est le
rmmod/modprobe : il semble que les effets secondaires soient importants !
Quand je me livre � ce genre de manipulation, le modprobe usb-uhci suivant
laisse le module dans un �tat bizarre (lsmod dit initializing ...). Le HUB
Belkin s'�teint (c'est joli et pratique toutes ses diodes de bon
fonctionnement) et tous mes p�riph�riques USB sont inaccessibles. Un bon
reboot et hop tout est reparti (mais l�, je me sens revenu sous windows).
Quelqu'un aurait-il une id�e/contournement pour ne pas casser la cha�ne USB
? Dans mon id�e, il faudrait un truc du genre kill -USR2 pppoeci pour qu'il
fasse un shutdown propre mais l�, je d�passe mon domaine de comp�tence actuel.
Tests effectu�s avec mdk8.2 et driver 0.5
En pi�ce jointe, le script tel que r�cup�r� sur le forum. Chose �trange, il
ne fonctionne r�ellement que si l'on prot�ge mieux les if :
stop() {
PPPOE_PID=$(ps -edf | grep pppoeci | grep -v grep | awk '{print $2}')
PPPD_PID=$(ps -edf | egrep "pppd call adsl" | grep -v grep | awk '{print $2}')
if [ ! $PPPOE_PID = "" ] || [ ! $PPPD_PID = "" ]; then
le if devient :
if [ ! "$PPPOE_PID" = "" ] || [ ! "$PPPD_PID" = "" ]; then
car j'ai eu souvent plusieurs instances du pppoeci (fork/threads ??)
Guillaume
#!/bin/bash
#
# adsl Starts ECI ADSL pppoa connection.
#
#
# chkconfig: 345 30 70
# description: Start/Stop ADSL Connection for ECI modem
CheckDir()
{
DIR_CHK=$1
for dir in ${DIR_CHK}
do
if [ ! -d $dir ]
then
echo "The directory $dir does not exist"
exit
fi
done
}
CheckFile()
{
FILE_CHK=$1
for file in ${FILE_CHK}
do
if [ ! -f $file ]
then
echo "The file $file does not exist"
fi
done
}
# Source function library.
. /etc/init.d/functions
ECI_SRCRIPT=/usr/local/bin/startmodem
LOG_DIR=/var/log
ECI_LOG=$LOG_DIR/eci.log
CHECK_DIR="$LOG_DIR"
CHECK_FILE="$ECI_SRCRIPT"
CheckDir "$CHECK_DIR"
CheckFile "$CHECK_FILE"
USB_TYPE="usb-uhci"
RETVAL=0
umask 077
start() {
PPP0=$(ifconfig ppp0 2>1 | grep inet | awk '{print $2}' | cut -d ":" -f2)
if [ -z $PPP0 ]; then
echo -n $"Starting ECI ADSL Connection: "
rmmod $USB_TYPE
modprobe $USB_TYPE
$ECI_SRCRIPT > $ECI_LOG
echo
# /etc/init.d/rc.firewall
/etc/init.d/named restart
/etc/init.d/qmail restart
echo
else
echo -n $"ECI ADSL Connection is already done !"
echo
echo -n $"ppp0 IP address is : $PPP0"
echo
fi
}
stop() {
PPPOE_PID=$(ps -edf | grep pppoeci | grep -v grep | awk '{print $2}')
PPPD_PID=$(ps -edf | egrep "pppd call adsl" | grep -v grep | awk '{print $2}')
if [ ! $PPPOE_PID = "" ] || [ ! $PPPD_PID = "" ]; then
echo -n $"Shutting down ECI ADSL Connection: "
echo
kill $PPPOE_PID $PPPD_PID
else
echo "ECI ADSL Connection is already shut down"
echo
fi
}
rhstatus() {
PPPOE_PID=$(ps -edf | grep pppoeci | grep -v grep | awk '{print $2}')
PPPD_PID=$(ps -edf | egrep "pppd call adsl" | grep -v grep | awk '{print $2}')
if [ ! $PPPOE_PID = "" ]; then
echo -n $"pppoeci (pid $PPPOE_PID) is running"
echo
else
echo -n $"pppoeci is not running"
echo
fi
if [ ! $PPPD_PID = "" ]; then
echo -n $"pppd (pid $PPPD_PID) is running"
echo
else
echo -n $"pppd is not running"
echo
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit $?