Skip to content
  • Facebook
  • YouTube
  • Twitter
  • LinkedIn
  • Inventory Mobile
  • Help
  • Changelog
Jonathan Ryan Grice's Blog

Jonathan Ryan Grice's Blog

  • JTTS
  • PGPC Live Stream
  • Gifts of the Spirit
  • Altar Worker’s Guide
    • Part 1 – Introduction
    • Part 2 – Etiquette
    • Part 3 – Creating an Environment for Healing and Deliverance
    • Part 4 – Submission
    • Part 5 – Empty Vessels Cannot Pour
    • Part 6 – Types of Prayer at the Altar
    • Part 7 – Conclusion
  • About Me
  • Toggle search form

UPDATE: OpenWrt Automated Roaming & System Management

Posted on March 9, 2026March 9, 2026 By Jonathan
Listen to this article

In this follow-up guide, we’ll elevate the previously built OpenWrt router with powerful automation features. The goal is to transform it into a truly ‘set it and forget it’ device that intelligently manages its own internet connection, power state, and system updates—making it perfect for use in a vehicle, as a travel router, or for any mobile application.

Project Highlights

  • Intelligent Network Roaming: Automatically scans for and connects to known Wi-Fi networks based on a priority system. It uses a hybrid event-driven and time-based approach for instant failover and proactive switching to better networks, all without disrupting the local access point.
  • Idle Auto-Poweroff: To save energy and reduce component wear, the device automatically shuts down after 15 minutes of inactivity (no connected Wi-Fi clients).
  • “Catch-Up” Auto-Updates: The router periodically checks for software updates. The system is smart enough to run an update check on boot if a scheduled check was missed, ensuring the device stays current and secure. Kernel-related packages are automatically excluded to maintain stability.

Core Features Explained

1. Intelligent Network Roaming

The centerpiece of this project is a smart, hybrid roaming system that replaces manual network selection. This provides a seamless, hands-off experience that is both fast and reliable.

How It Works (Hybrid Approach):

  1. Instant Failover (Event-Driven): A hotplug script (/etc/hotplug.d/iface/99-roam-trigger) constantly watches the WAN connection. If the current Wi-Fi network goes out of range and disconnects, this script triggers immediately, running the main roaming script to find and connect to the next best network. This ensures a rapid switch-over with minimal downtime.
  2. Proactive Switching (Time-Based): A cron job runs the main roaming script (/usr/bin/roam.sh) every 3 minutes. This handles situations where the current connection is stable, but a higher-priority network has come into range. The script will detect the better network and switch to it automatically.
  3. Prioritized Profiles: The script makes decisions based on a priority number assigned to each saved Wi-Fi network in /etc/config/wireless. It always tries to connect to the available network with the highest priority number.

2. Idle Auto-Poweroff

To save power, the device will automatically shut down if no clients are connected to its local Access Point for 15 minutes.

  • Script: /usr/bin/idle-poweroff.sh
  • Trigger: Runs every minute via a cron job.
  • Logic: If the script detects zero connected clients, it starts a 15-minute timer. If a client connects, the timer is cancelled. If 15 minutes pass with no clients, it performs a final check and then powers off the device.

3. “Catch-Up” Auto-Update

This script ensures your OpenWrt system stays up-to-date without requiring manual intervention, even if the device is powered off for long periods.

  • Script: /usr/bin/auto-update.sh
  • Trigger: Runs at every boot (@reboot) via a cron job.
  • Logic: On boot, the script checks a timestamp to see when the last update was run. If it has been more than 7 days, it automatically runs opkg update and opkg upgrade, safely excluding kernel packages. On success, it updates the timestamp.

Download & Installation

You can download all the scripts mentioned in this guide in a single zip file.

Download Automation Scripts

Installation Instructions

After downloading and unzipping the file, you will need to place each script in the correct location on your OpenWrt device and make them executable. You can use an SCP client like WinSCP or the command line.

  1. Roaming Script:
    Place roam.sh in /usr/bin/ and run: chmod +x /usr/bin/roam.sh
  2. Roaming Trigger:
    Place 99-roam-trigger in /etc/hotplug.d/iface/ and run: chmod +x /etc/hotplug.d/iface/99-roam-trigger
  3. Idle Power-Off Script:
    Place idle-poweroff.sh in /usr/bin/ and run: chmod +x /usr/bin/idle-poweroff.sh
  4. Auto-Update Script:
    Place auto-update.sh in /usr/bin/ and run: chmod +x /usr/bin/auto-update.sh

Configuration

Adding a New Wi-Fi Network

The roaming script will automatically incorporate new networks. Simply add a new network profile in the OpenWrt web interface (under Network -> Wireless) and follow these steps:

  1. Scan and join the new network as a client (station) on the correct radio device. Make sure it’s assigned to the correct firewall zone.
  2. Find the new network profile, click Edit, and go to the Advanced Settings tab.
  3. In the “Interface-Properties” section, find the Priority field and enter a number. A higher number means a higher priority. For example, your most preferred network could be 10, while a less-preferred one is 5.
  4. Ensure the interface is disabled. The script will enable it as needed.
  5. Save and apply your changes.

Verifying Cron Jobs

After installation, the system’s cron jobs should be configured to run the automation scripts. You can verify this by running crontab -l via SSH. The output should look like this:

@reboot /usr/bin/auto-update.sh
*/3 * * * * /usr/bin/roam.sh
* * * * * /usr/bin/idle-poweroff.sh

Conclusion

This setup transforms a standard Raspberry Pi into a powerful, self-sufficient mobile routing platform. It reliably manages its internet connectivity and system health, providing a seamless experience with minimal user intervention.

Tutorials Tags:Auto-Update, Automation, Car WiFi, Cron, DIY Router, Embedded Systems, Hotplug, IoT, Linux, Mobile Router, Network Automation, Networking, OpenWrt, Portable Internet, Power Management, Raspberry Pi, Shell Scripting, System Administration, Travel Router, Wi-Fi Roaming

Post navigation

Previous Post: How to Build a Custom Minimal Ubuntu 24.04 Image for Raspberry Pi 3B

Popular Posts

  • How to Build the Ultimate Portable “Travel Router” with Raspberry Pi & OpenWrt 169 views
  • Hell and the Lake of Fire: A Biblical Distinction 165 views
  • Altar Worker’s Guide: Part 5 – Empty Vessels Cannot Pour 57 views
  • Altar Worker’s Guide: Part 3 – Creating an Environment for Healing and Deliverance 51 views
  • Product Review – Plantronics Voyager Legend – Excellent Across the Board! 51 views

Be Notified Of New Posts

Copyright © 2026 Jonathan Ryan Grice's Blog.

Powered by PressBook WordPress theme