Notify WAN IP change

Hi, ive tried to script notification when IP change.
Im using it on my connection, 1 Public IP on WAN, nothing complicated like dualwan. Works fine for me.

Its necessary to add script into crontab
More info GitHub - pschonmann/turris-utils: Bunch of utils thats can be usefull for turris users.

Script itself

Feel free to fork or improve the script.

1 Like

Sounds interesting, great work!
Have implemented it, hope that is correct so far.

Copied the script as bash into the newly created folder:
/srv/custom_scripts/notify_change_ip.sh

and set the query in the crontab:
*/15 * * * /srv/custom_scripts/notify_change_ip.sh

Mail notification is turned on, but get the following message in the log:

Dec 20 16:45:01 turris crond[4948]: (root) CMD (/srv/custom_scripts/notify_change_ip.sh)
Dec 20 16:45:01 turris crond[4946]: (root) CMDOUT (/bin/sh: /srv/custom_scripts/notify_change_ip.sh: permission denied)
Dec 20 16:45:01 turris crond[4946]: (root) CMDEND (/srv/custom_scripts/notify_change_ip.sh)

Does the folder or script still need special permissions?

Many thanks already!
Best regards

Did you set the executable permission on that script?

currently Octal 0644 is set, so no execute.
Which owners should I give the right?

Up to your choice.
I would just mark it as being executable.

I don’t think you need to use cron for such things. There are hooks called on various network events: [OpenWrt Wiki] Hotplug

1 Like

What about using mktemp for the working dir?