Send an SMS from a GL.iNet cellular router when it boots — ideal for alerts after power outages or unexpected reboots.
This project targets GL.iNet / OpenWrt firmware that includes the built-in sendsms utility (for example: GL-XE3000 (Puli AX), GL-X3000 (Spitz AX) and other cellular models). It also includes a Textbelt option for devices without a cellular modem.
- 📲 Sends an SMS on router boot
- 🔌 Great for power-outage notifications
- 🌐 Automatically detects the active cellular WAN interface
- 🕒 Built-in cooldown to prevent SMS spam
- 🛠 Uses GL.iNet’s native
sendsmsbackend (same path as the web UI) - 🔔 Optional webhook POST with JSON payload on boot
- Root access on the router (
ssh root@<router-ip>) - Internet access to fetch installer scripts
- For the sendsms version: GL.iNet firmware with
sendsmsavailable - For the Textbelt version: a Textbelt API key
Replace <YOURNUMBER> with the phone number that should receive the SMS:
Example including country code: +13038675309
For the textbelt version replace <YOURNUMBER> and <YOUR_TEXTBELT_KEY>
# SENDSMS (Cellular SIM) Version
sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/install.sh)" -- <YOURNUMBER>
# Textbelt Version
sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/install_textbelt.sh)" -- <YOURNUMBER> <YOUR_TEXTBELT_KEY> [WEBHOOK_URL]
# Combined Version (interactive, no arguments)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/install_combined.sh)"
# Combined Version (non-interactive with webhook)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/install_combined.sh)" -- \
--prefer textbelt --phone <YOURNUMBER> --textbelt-key <YOUR_TEXTBELT_KEY> --webhook-url <WEBHOOK_URL>- Copy
sms_on_boot.shto/usr/bin/sms_on_boot.sh - Edit the
PHONEvalue inside the script. - Optional: set
WEBHOOK_URLto receive a JSON payload. - Create an init script:
cat > /etc/init.d/sms_on_boot <<'EOF' #!/bin/sh /etc/rc.common START=99 start() { /usr/bin/sms_on_boot.sh & } EOF chmod +x /etc/init.d/sms_on_boot /etc/init.d/sms_on_boot enable
- Copy
sms_on_boot_textbelt.shto/usr/bin/sms_on_boot_textbelt.sh - Edit
PHONEandTEXTBELT_KEYinside the script. - Optional: set
WEBHOOK_URLto receive a JSON payload. - Create an init script:
cat > /etc/init.d/sms_on_boot_textbelt <<'EOF' #!/bin/sh /etc/rc.common START=99 start() { /usr/bin/sms_on_boot_textbelt.sh & } EOF chmod +x /etc/init.d/sms_on_boot_textbelt /etc/init.d/sms_on_boot_textbelt enable
- Copy
sms_on_boot_combined.shto/usr/bin/sms_on_boot_combined.sh - Create
/etc/sms_on_boot_combined.conf:cat > /etc/sms_on_boot_combined.conf <<'EOF' PHONE="+17192291657" PREFER="textbelt" # or sendsms TEXTBELT_KEY="textbelt" WEBHOOK_URL="" EOF chmod 600 /etc/sms_on_boot_combined.conf
- Create init script:
cat > /etc/init.d/sms_on_boot_combined <<'EOF' #!/bin/sh /etc/rc.common START=99 start() { /usr/bin/sms_on_boot_combined.sh & } EOF chmod +x /etc/init.d/sms_on_boot_combined /etc/init.d/sms_on_boot_combined enable
- Cooldown: Each script has a
COOLDOWNsetting (default 300s) to prevent SMS spam. - Webhook: Set
WEBHOOK_URLto POST a JSON payload on boot (uses curl, logs response code/body). - Logs:
/tmp/sms_on_boot.log/tmp/sms_on_boot_textbelt.log/tmp/sms_on_boot_combined.log
rm -f /etc/sms_on_boot.last && /usr/bin/sms_on_boot.sh && cat /tmp/sms_on_boot.logrm -f /etc/sms_on_boot_textbelt.last && /usr/bin/sms_on_boot_textbelt.sh && cat /tmp/sms_on_boot_textbelt.logrm -f /etc/sms_on_boot_combined.last && /usr/bin/sms_on_boot_combined.sh && cat /tmp/sms_on_boot_combined.logsh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/uninstall.sh)"sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/uninstall_textbelt.sh)"sh -c "$(curl -fsSL https://raw.githubusercontent.com/techrelay/GL.iNet-CellularModels-SMSonBoot/main/uninstall_combined.sh)"