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!

Thanks, looks good. Likely an NTP issue, can you just confirm in your router log, those times wicens sent you the Email it was logged as being called by wan-event and not cron? Im fairly certain this is an NTP issue as my script is setting the epoch time before NTP has done its thing

Does your router reboot on WAN drops or anything?
I just checked and wicens have been executed 2 minutes after ntp was set....
 
run_epoch is set immediately which is what it uses to set new saved_wan_epoch variables... the intention was to identify the time as early as possible but if NTP isnt updated you'll get those results, an oversight by me

Ill likely change what sets the epoch/date variables (and wan-event call execution) to a function that runs after NTP is set. My 90sec sleep on wan-event was just being lazy :cool:

If you manually run right now and select option 4 (sample email), does it correctly display the lease time?
 
updated to 1.10, Added NTP sync wait (pinched from the famous JackYaz), re-download from link in first post

Should eliminate all issues recording dates/times in script. Script will not function if your router cannot use NTP to update date/time

Would be best to create a new config, but a backup should work assuming all dates/times are correct.
 
updated to 1.10, Added NTP sync wait (pinched from the famous JackYaz), re-download from link in first post

Should eliminate all issues recording dates/times in script. Script will not function if your router cannot use NTP to update date/time

Would be best to create a new config, but a backup should work assuming all dates/times are correct.
Ironically enough, when do you call the NTP wait and from which script on boot? Might be an issue with it....
 
Ironically enough, when do you call the NTP wait and from which script on boot? Might be an issue with it....
There was no NTP/time/date checks before, my thought on his issue is when it went to calc the lease time, if NTP wasnt updated it would calc based on a time/date in the past which was spitting the negative value.

For now, Ive pinched your NTPwait code from connmon and just left it as the first instruction after locking the script, technically it'll wait for NTP to update so the correct epoch/dates get set, otherwise after 5 mins it closes and waits for the cron run.
 
Last edited:
Updated to v1.10, everything looks good, thanks!

Missing an update feature, but backup/restore does the trick.
 

Attachments

  • Screenshot_20210202-085917692_1.jpg
    Screenshot_20210202-085917692_1.jpg
    38.8 KB · Views: 129
Hello my friend, for some reason email stopped sending.
To try to solve, I configured everything again, created new gmail app password, but same symptoms
 

Attachments

  • Screenshot_20210212-095851755.png
    Screenshot_20210212-095851755.png
    243.3 KB · Views: 167
Hmmm you seem to always have issues on alpha/beta firmwares. I cant debug these as I generally on run stable, with the exception of recently when I was on 386.1b3

For starters, HELO/EHLO isnt sending an ID, do you have a name set on the WebGUI under Lan-->HostName?

Is there a reason you need to use 587/TLS with Google? Can you try 465/SSL, it uses Curl instead.
 
Hmmm you seem to always have issues on alpha/beta firmwares. I cant debug these as I generally on run stable, with the exception of recently when I was on 386.1b3

For starters, HELO/EHLO isnt sending an ID, do you have a name set on the WebGUI under Lan-->HostName?

Is there a reason you need to use 587/TLS with Google? Can you try 465/SSL, it uses Curl instead.


Yes, I have name set on the hostname....

I was using 587 for no reason at all, it was working from the beginning, so I was using 587...
I changed now to 465 and it started working :)

Thanks pal
 
@maghuro,

New firmware (with full reset) is a great time to revisit all the old 'habits' we gain over the years and put them to the test. 'Blindly' putting in old settings/options is not the way to a good network experience.

What worked once upon a time, is a delightful story. Using what works today is better. :)

Best Practice Update/Setup Router/AiMesh Node(s) 2021
 
Yes, I have name set on the hostname....

I was using 587 for no reason at all, it was working from the beginning, so I was using 587...
I changed now to 465 and it started working :)

Thanks pal
Thanks for the follow up. My guess is it worked before for you, but then you updated to 386.2Alpha and didnt test it

587/TLS should work with Gmail (it does on 386.1stable), its likely something with 386.2alpha between sendmail and the hostname, Ill wait till 386.2 goes stable before looking into it more.

And my bad I forgot TLS was the successor and is what most people use but glad SSL is working through Curl for ya.
 
Hey OP just wanted so thank you for this. The mail config process was great.. wish it was the default for all these notification scripts I got going on. But awesome.. great job!
 
Hey OP just wanted so thank you for this. The mail config process was great.. wish it was the default for all these notification scripts I got going on. But awesome.. great job!

Agreed 100% - excellent coding script !!
 
Question: is there a reason why the version has to be 384.15? I'm running an AC66U that won't go higher than 380.70. I have Entware installed. Thanks.

EDIT: Thanks, but nevermind. I found John's fork and may try that.
 
Last edited:
Question: is there a reason why the version has to be 384.15? I'm running an AC66U that won't go higher than 380.70. I have Entware installed. Thanks.

EDIT: Thanks, but nevermind. I found John's fork and may try that.
It relies on getrealip.sh script which was introduced in the newer firmwares. I havent had a chance to try on Johns newer releases but I did add support for his Fork back on 48E7 release after he graciously added the getrealip.sh to his fork.

Is it possible to remake this script to send notifications in telegram messenger?
Likely not, if you write your own script for sending notifications through telegram messenger, you can you use Option S and call your own script from Wicens and if it works well for you I may have a look at adding it.
 
Likely not, if you write your own script for sending notifications through telegram messenger, you can you use Option S and call your own script from Wicens and if it works well for you I may have a look at adding it.
Unfortunately, I am not friends with scripts. But there is a simple script for sending a telegram notification of a new fw version release.
Create your own telegram bot via @BotFather
Maybe on its basis it is possible to make notifications?
 
Last edited:
Version 2 released

Added Auto/manual update check
New backup/restore
and other changes.
 
Dear,
Wicens should check which wan is being used as primary at the moment.
For example - a couple of days ago, some hackers took down an entire mobile communications company in Portugal. We went without cable internet.
My solution was to use my Android phone, connected it to router with USB cable (tethering), and set primary wan to USB.

Wicens kept getting a private ip stored in nvram (wan0_ipaddr I think) and it didn't update.

The solution was changing that nvram value to 0 and wicens started forcing update.
Now, in router first page, it says my wan IP is 0, because I manually changed it.


Or - another solution, the best I think - everytime wicens detects a private it, force the update and use getrealip.sh
 
Or - another solution, the best I think - everytime wicens detects a private it, force the update and use getrealip.sh
Private IPs defeat the purpose of the script hence it fails on detection and should have logged as such

edit: Ill push an update with your suggestion, version 2 did break support for double nat (your scenario)
 
Last edited:

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