Best way to keep alive mobile connection + openvpn?



Dear Guys,

We try to make a system, based on debian testing with MM 0.5.2, which is able to provide the following:

As I can see at this moment, we have to write our own control script, which controls at this moment only the 2G/3G connection:

As in the last few days I found some strange issues with the stability of the mobile connection, I wonder how others solve this kind of problem?

Do you have any solution, recommendation? Of course the solution should be bullet-proof :)

Here is our basic  control script. The mobile connection has Autoconnect checked.

Any better idea?

Thanks, István

------------ script runs as user with nopasswd sudo or as root -----------------

#!/bin/bash
gsm_status_log="/tmp/1wire_fs/gsm_status"

# What The Fuck indicator: 0: ok, 1: connecting, 2: turn on wwan, 3: there is no modem or unknown statu
WTF=0
SLEEPTIME=45 # 45 seconds between checks

while [ TRUE ] ; do
GSMSTATUS=`nmcli dev status | grep gsm | gawk '{print $3}'`
DATUM=`date +"%Y-%m-%d %H:%M"`
# echo "GSM_STATUS: $GSMSTATUS"

if [ "$GSMSTATUS" == "kapcsolódva" ]; then
if [ $WTF -ne 0 ] ; then
echo "$DATUM - GSM kapcsolódva." >> /var/log/gsm_status.log
WTF=0
fi
echo "UP" > $gsm_status_log
elif [ "$GSMSTATUS" == "kapcsolódás" ]; then
if [ $WTF -ne 1 ]; then
echo "$DATUM - GSM kapcsolódás folyamatban." >> /var/log/gsm_status.log
WTF=1
fi
echo "CONNECTING" > $gsm_status_log
else
if [ "$GSMSTATUS" == "leválasztva" ]; then
if [ $WTF -ne 2 ]; then
echo "$DATUM - GSM kapcsolódás indul." >> /var/log/gsm_status.log
WTF=2
fi
echo "RECONNECT" > $gsm_status_log
if [ `whoami` == "root" ]; then
nmcli nm wwan on
else
sudo nmcli nm wwan on
fi
else
  if [ $WTF -ne 3 ]; then
      echo "$DATUM - GSM nem található, vagy ismeretlen státusz: $GSMSTATUS" >> /var/log/gsm_status.log
      WTF=3
     fi
    echo "UNKNOWN" > $gsm_status_log
  fi
fi
sleep $SLEEPTIME
done


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]