this is about creating a raspberry pi based appliance that monitors your internet conenction and if it goes down, automatically debugs it and restarts stuff like modem / router etc. as necessary. the device should also be reachable via an on-demand gsm link that can be initated by sms to login to the device and debug the link manually
so far, this is just a collection of snippets of information and links, i'll write it up into a nice article one day, but not today ;)
apt update && apt install wvdial gammu gammu-smsd picocom
gammu identify
only gets information from that device). gammu-detect | grep -B1 TP-LINK | grep ttyUSB | tail -n 1
to get the device name for the config
/etc/gammu-smsdrc.template
# Configuration file for Gammu SMS Daemon # Gammu library configuration, see gammurc(5) [gammu] port = %PORT% connection = at #logformat = textall # SMSD configuration, see gammu-smsdrc(5) [smsd] service = null logfile = syslog # Increase for debugging information debuglevel = 0 RunOnReceive = /opt/process-sms.sh
/root/.gammurc
[gammu] device = %PORT% connection = at
/opt/updateModemPort.sh
#!/bin/bash port=$(gammu-detect | grep -B1 TP-LINK | grep ttyUSB | tail -n 1 | awk -F = '{print $2}' | tr -d " ") sed -e "s|%PORT%|${port}|" /etc/gammu-smsdrc.template > /etc/gammu-smsdrc sed -e "s|%PORT%|${port}|" /root/.gammurc.template > /root/.gammurc
apt install gammu gammu-smsd
#!/bin/bash for i in `seq $SMS_MESSAGES` ; do numvar="SMS_${i}_NUMBER" textvar="SMS_${i}_TEXT"; echo "${!numvar}:${!textvar}" >> /tmp/messages if [ "${!textvar}" == "connect" ]; then echo "connect!" >> /tmp/messages fi done
/etc/wvdial.conf.template
[Dialer Defaults] Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","internet" Modem Type = Analog Modem Baud = 960000 New PPPD = yes Modem = %PORT% ISDN = 0 Phone = *99# Password = { } Username = { }
picocom