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
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 d/networking restart
echo "Connection up, reconnect not required..."
exit 0
else
echo "Connection down, reconnecting..."
#/etc/init.
killall modem-manager
modem-manager
killall NetworkManager
fi