Add new check_interval_min value

To be able to set a check interval lower than the previously hard-coded 5 minutes.
This commit is contained in:
Brian J. Murrell 2023-04-19 08:49:09 -04:00 committed by GitHub
parent 9781128b27
commit a9535e4fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -152,8 +152,9 @@ trap "trap_handler 15" 15 # SIGTERM Termination
# ip_script full path and name of your script to detect current IP
# ip_interface physical interface to use for detecting
#
# check_interval check for changes every !!! checks below 10 minutes make no sense because the Internet
# check_unit 'days' 'hours' 'minutes' !!! needs about 5-10 minutes to sync an IP-change for an DNS entry
# check_interval check for changes every
# check_interval_min check_interval minimum value (used to be check_interval's minimum value of 300 seconds)
# check_unit 'days' 'hours' 'minutes'
#
# force_interval force to send an update to your service if no change was detected
# force_unit 'days' 'hours' 'minutes' !!! force_interval="0" runs this script once for use i.e. with cron
@ -287,8 +288,10 @@ fi
# compute update interval in seconds
get_seconds CHECK_SECONDS ${check_interval:-10} ${check_unit:-"minutes"} # default 10 min
get_seconds CHECK_SECONDS_MIN ${check_interval_min:-5} ${check_unit}
get_seconds FORCE_SECONDS ${force_interval:-72} ${force_unit:-"hours"} # default 3 days
get_seconds RETRY_SECONDS ${retry_interval:-60} ${retry_unit:-"seconds"} # default 60 sec
[ $CHECK_SECONDS -lt 300 ] && CHECK_SECONDS=$CHECK_SECONDS_MIN # minimum 5 minutes
[ $FORCE_SECONDS -gt 0 -a $FORCE_SECONDS -lt $CHECK_SECONDS ] && FORCE_SECONDS=$CHECK_SECONDS # FORCE_SECONDS >= CHECK_SECONDS or 0
write_log 7 "check interval: $CHECK_SECONDS seconds"
write_log 7 "force interval: $FORCE_SECONDS seconds"