[WICENS] WAN IP Change Email Notification Script

maghuro

Very Senior Member
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....
 

Maverickcdn

Senior Member
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?
 

Maverickcdn

Senior Member
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.
 

Jack Yaz

Part of the Furniture
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....
 

Maverickcdn

Senior Member
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:

maghuro

Very Senior Member
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: 85

maghuro

Very Senior Member
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: 115

Maverickcdn

Senior Member
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.
 

maghuro

Very Senior Member
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
 

L&LD

Part of the Furniture
@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
 

Maverickcdn

Senior Member
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.
 

sone

Occasional Visitor
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!
 

joe scian

Very Senior Member
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 !!
 

BigTulsa

New Around Here
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:

Maverickcdn

Senior Member
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.
 

Joyz

Occasional Visitor
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:

Maverickcdn

Senior Member
Version 2 released

Added Auto/manual update check
New backup/restore
and other changes.
 

maghuro

Very Senior Member
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
 

Maverickcdn

Senior Member
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

Sign Up For SNBForums Daily Digest

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