Comment 20 for bug 566812

Revision history for this message
Gabriel Couto (gabrielrcouto) wrote : Re: USB Modem wont connect after modem hangup

I use a script to reconnect my ONDA 3G modem, because the solution above doesn't work for me. My script is executed by cron, every 5 minutes.

#!/bin/bash

MCHECK=`lsusb | grep ONDA`

if ! [ -n "$MCHECK" ]; then
echo "3G/GPRS modem not in use, ignoring..."
exit 0
fi

NCHECK=`/sbin/ifconfig ppp`
NCHECK1=`echo $NCHECK | cut -d " " -f 1`

if [ "$NCHECK1" = "ppp0" ]; then
echo "Connection up, reconnect not required..."
exit 0
else
echo "Connection down, reconnecting..."
#/etc/init.d/networking restart
killall modem-manager
modem-manager
killall NetworkManager
fi