What's new
  • 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!

[WICENS] WAN IP Change Email Notification Script v4

how? I want the script to just notify when router reboots and do write constantly on /jffs filesystem to keep track of WAN IP or any other changes.
The 11 minute cron is automatically added upon enabling any notification type. Its used to monitor for failed Email attempts and update Router uptime etc

Unfortunately WAN IP change monitoring cannot be enabled without also enabling WAN IP Email notifications, if you want WAN IP changes logged you must enable the Email notifications for it
 
The 11 minute cron is automatically added upon enabling any notification type. Its used to monitor for failed Email attempts and update Router uptime etc

Unfortunately WAN IP change monitoring cannot be enabled without also enabling WAN IP Email notifications, if you want WAN IP changes logged you must enable the Email notifications for it

I think it would be better if script can allow some customization of cron expression itself... Like every 10 days ... i dont want to write to /jffs every 11 mins or even every hour (which is the the max we can configure using current script).
 
Altering cron run intervals will directly affect the calculated estimated down time during reboot notifications... ie. you set cron to 10 days when the router comes back up if the last time cron ran was 10 days ago (last time router uptime was recorded) the reboot Email notification will say the router was down for 10 days between powerloss/reboot. If an Email fails to send the script will not try again till next time cron is scheduled to run.

As you're already aware you can edit cron in /jffs/scripts/addons/wicens/wicens_update_conf.wic to 59 mins, or this is the code used to check cron status
Code:
F_cru() {
    case "$1" in
        'check')
            cru l | grep -Fq "$script_name_full" && return 0
            return 1
        ;;

        'create')
            cru a wicens "*/${cron_check_freq} * * * * $script_name_full cron"
            F_log_terminal_ok "Added entry in cron(cru) with ${cron_check_freq}m interval"
        ;;

        'remove')
            if F_cru check ; then
                cru d wicens
                F_log_terminal_ok "Removed entry in cron(cru)"
            else
                F_terminal_check_ok "No entry in cron(cru) to remove"
            fi
        ;;
    esac
    return 0
} # cru

You can manually create any cron interval you want within cru as long as the script path contains /jffs/scripts/wicens.sh cron in your cru entry the script will operate fine, just remember router downtime calculations in reboot emails will be borked and re-attempts wont happen until cron runs again
 
Altering cron run intervals will directly affect the calculated estimated down time during reboot notifications... ie. you set cron to 10 days when the router comes back up if the last time cron ran was 10 days ago (last time router uptime was recorded) the reboot Email notification will say the router was down for 10 days between powerloss/reboot. If an Email fails to send the script will not try again till next time cron is scheduled to run.

As you're already aware you can edit cron in /jffs/scripts/addons/wicens/wicens_update_conf.wic to 59 mins, or this is the code used to check cron status
Code:
F_cru() {
    case "$1" in
        'check')
            cru l | grep -Fq "$script_name_full" && return 0
            return 1
        ;;

        'create')
            cru a wicens "*/${cron_check_freq} * * * * $script_name_full cron"
            F_log_terminal_ok "Added entry in cron(cru) with ${cron_check_freq}m interval"
        ;;

        'remove')
            if F_cru check ; then
                cru d wicens
                F_log_terminal_ok "Removed entry in cron(cru)"
            else
                F_terminal_check_ok "No entry in cron(cru) to remove"
            fi
        ;;
    esac
    return 0
} # cru

You can manually create any cron interval you want within cru as long as the script path contains /jffs/scripts/wicens.sh cron in your cru entry the script will operate fine, just remember router downtime calculations in reboot emails will be borked and re-attempts wont happen until cron runs again

Thanks for the response. As my requirement is just to send a email when router reboots and dont care about time and all so altering cron expression manually in script will work fine for me.

I think I might need to change in "F_serv_start()" function too correct?
 
Thanks for the response. As my requirement is just to send a email when router reboots and dont care about time and all so altering cron expression manually in script will work fine for me.

I think I might need to change in "F_serv_start()" function too correct?
No sweat

Sorry yes, in order to not have to manually create your custom cru(cron) after reboots that function would need to be edited in /jffs/scripts/wicens.sh to be persistent.

Although you will always show a MD5(hotfix) update if ever checking for script updates. At this point if there ever is an update it will be version number change though. I've taken a massive leap and Im currently implementing an Opnsense firewall as my gateway so there likely won't be any further development of this script
 

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!
Back
Top