What's new

[WICENS] WAN IP Change Email Notification Script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

I really like this useful tool. It can automatically notify me about changes in the router's status, allowing me to check my email on my phone without having to log in to the router. Recently, I upgraded to version 4.0 and reinstalled it. I encountered the following error message when trying to use the backup function. Is this expected behavior?

1716700368486.png
 
I really like this useful tool. It can automatically notify me about changes in the router's status, allowing me to check my email on my phone without having to log in to the router. Recently, I upgraded to version 4.0 and reinstalled it. I encountered the following error message when trying to use the backup function. Is this expected behavior?
If you're using amtm email settings this is expected, it doesn't back up your amtm email settings, the script dynamically syncs with amtm everytime its run

edit: to clarify the script will only backup passwords saved by configuring email settings in wicens (not amtm import). All saved passwords are removed (aside from backups) when amtm import is enabled and the script does not backup your amtm email settings. Ive changed the wording around this in the backup for the next release.
 
Last edited:
4.01 out to correct multiple notifications on reboot and some appearance
Code:
## 4.01
* CHANGED: prevent cron execution if router up less than 10 mins
* CHANGED: F_getrealip don't sleep if grabbing WAN IP for the first time
* CHANGED: misc wording for when new fw version found and password backup (not backed up when amtm enabled)
 
Ive changed the wording around this in the backup for the next release.

The backup instructions for the new version are very easy to understand. 👍

1717201939526.png


Additionally, I want to commend your script for being one of the few that displays the change log during the installation process. This thoughtful design saves users the time and effort of independently searching to understand the differences in the new version. Thank you!

螢幕擷取畫面 2024-06-01 080144.png
 
4.01 out to correct multiple notifications on reboot and some appearance
Code:
## 4.01
* CHANGED: prevent cron execution if router up less than 10 mins
* CHANGED: F_getrealip don't sleep if grabbing WAN IP for the first time
* CHANGED: misc wording for when new fw version found and password backup (not backed up when amtm enabled)
Thanks!! Great update and nice messages too.

Just a minor point the version is still showing 4.00 after the 4.01 update?

Another minor comment is it’s a bit confusing where it says “create a backup before upgrading?”, there’s no (y or n) prompt and even if I try answer (n) it doesn’t continue, I can only answer (c) continue. I did not try y.
 

Attachments

  • IMG_1280.jpeg
    IMG_1280.jpeg
    57 KB · Views: 20
  • IMG_1281.jpeg
    IMG_1281.jpeg
    39 KB · Views: 20
Last edited:
The backup instructions for the new version are very easy to understand. 👍

Additionally, I want to commend your script for being one of the few that displays the change log during the installation process. This thoughtful design saves users the time and effort of independently searching to understand the differences in the new version. Thank you!
Thanks for the compliments

Thanks!! Great update and nice messages too.
👍
Just a minor point the version is still showing 4.00 after the 4.01 update?
The issue with the versioning I caught not long after the initial commit, its been fixed you may have an md5 update available. https://github.com/maverickcdn/wicens/commit/2c12d4ca7648070d14088027a90926fccc85b52a
Another minor comment is it’s a bit confusing where it says “create a backup before upgrading?”, there’s no (y or n) prompt and even if I try answer (n) it doesn’t continue, I can only answer (c) continue. I did not try y.
I've changed the wording around this for the next one, its meant to read as a warning to back out and create a backup from the main menu, not from within the script update menu
backup.jpg
 
Got an email tonight saying
Script ran with option : reboot
But.. I wasn't logged in to run any script, and an unsure of why there would be an unexpected reboot..

Any log that'll help me?

Thanks
 
It looks like this script will accomplish a very specific task I need with a little bit of help from a custom script that it can call. I've searched the forum and the Wiki for something along the lines of "change WAN DNS servers via bash or command line" but can't find anything.

I originally posted about this scenario in this thread, and Viktor was kind enough to point me here.

I use NordVPN's SmartDNS servers so that I can bypass geo-restrictions for streaming content. When my WAN IP changes, Nord's SmartDNS servers will no longer respond to DNS queries. Does anyone know how to change the WAN DNS servers via a bash script instead of going to this page on the GUI?
1735228028563.png
 
I asked ChatGPT and it came up with this script:
Bash:
#!/bin/sh

# Replace with your desired DNS servers
DNS1="8.8.8.8"
DNS2="8.8.4.4"

# Apply the DNS settings
nvram set wan0_dns="$DNS1 $DNS2"
nvram set wan0_dns1="$DNS1"
nvram set wan0_dns2="$DNS2"
nvram commit

# Restart the WAN interface to apply changes
service restart_wan

But I think it was wrong about some of those nvram settings because when I used it it caused a lot of problems.

EDIT: I think this might be it:

Bash:
#!/bin/sh

# Replace with your desired DNS servers
DNS1="9.9.9.11"
DNS2="149.112.112.11"

# Apply the DNS settings
nvram set wan0_dns="$DNS1 $DNS2"
nvram set wan0_dns1_x="$DNS1"
nvram set wan0_dns2_x="$DNS2"
nvram set wan_dns="$DNS1 $DNS2"
nvram set wan_dns1_x="$DNS1"
nvram set wan_dns2_x="$DNS2"
nvram commit

# Restart the WAN interface to apply changes
service restart_wan

I used nvram show | grep dns to find the correct values.
 
Last edited:
It worked!
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top