Idle Timeout Disconnect for Cellular Connection
This is a simple script to disconnect a cellular modem connection if 0 bytes have been transmitted/received since the last time it was run.
This script is run out of cron to schedule the script to run at provided intervals.
For example by running this from cron every 15 minutes it will be able to disconnect the modem in between 15 & 30 minutes of no traffic.
There is a constant CONSIDERED_IDLE which is defaulted to 0 bytes that can be tuned as a heuristic for the maximum amount of data we consider as not counting towards making the connection not idle. Often small packets of GPS data create minimal traffic that would require a user to safely bump up the CONSIDERED_IDLE value to "1024".
First, copy the attached idle timeout script onto the unit:
scp idle.sh opengear:/etc/config/idle.sh
Next, edit the crontab entry.
Edit /etc/config/crontab.root to contain the entry
*/15 * * * * sh /etc/config/idle.sh
For the ~15 minute functionality outlined above.
Finally, reload crontab
# crontab /etc/config/crontab.root
This script may not be useful for customers running constant/regular traffic generating services such as a VPN or NTP as they will continue to send / receive traffic even when a customer would class the modem as idle.