Commit 1285d1f0 authored by Adam Wujek's avatar Adam Wujek

[BUG: #252] rootfs/etc/init.d: fix adding crom entries for system clock monitor

Reduce the possible range in Kconfig to the half of the possible range.
E.g. setting job to be run every 40minutes is not trivial and */40 will
not work. Instead it will run the job at minute 0, then 40, then again
at 0 (after 40min, then after 20min).
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 053e07d9
......@@ -935,6 +935,9 @@ choice SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_UNIT
default SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES
help
Defines the unit used for the check interval value.
Please note that values more than a half of possible range
(e.g. 40 minutes are not possible to set).
Check cron manual for more details.
config SNMP_SYSTEM_CLOCK_UNIT_MINUTES
bool "Minutes"
......@@ -943,36 +946,45 @@ config SNMP_SYSTEM_CLOCK_UNIT_HOURS
bool "Hours"
config SNMP_SYSTEM_CLOCK_UNIT_DAYS
bool "Days "
bool "Days"
endchoice
config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_MINUTES
int "Interval to verify system clock (Minutes)"
range 1 59
range 1 30
default 10
help
Sets the time interval between checks of the system clock.
This interval is expressed in minutes.
Written to cron config file as:
*/val * * * *
Check cron manual for more details.
config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_HOURS
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_HOURS
int "Interval to verify system clock (Hours)"
range 1 23
range 1 12
default 1
help
Sets the time interval between checks of the system clock.
This interval is expressed in hours.
Written to cron config file as:
0 */val * * *
Check cron manual for more details.
config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_DAYS
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_DAYS
int "Interval to verify system clock (Days)"
range 1 31
range 1 16
default 1
help
Sets the time interval between checks of the system clock.
This interval is expressed in days
Written to cron config file as:
0 0 */val * *
Check cron manual for more details.
endmenu
......
......@@ -240,14 +240,14 @@ if [ "$#" -eq 1 ] && [ "$1" == "-s" ] ; then
intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_HOURS
debug "Time interval: ${intervalValue} hours"
entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} hour(s)${NEWLINE}"
entry+="* */${intervalValue} * * * ${script}"
entry+="0 */${intervalValue} * * * ${script}"
setCronConfig "$entry"
else
if [ "$CONFIG_SNMP_SYSTEM_CLOCK_UNIT_DAYS" = "y" ]; then
intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_DAYS
debug "Time interval: ${intervalValue} days"
entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} day(s)${NEWLINE}"
entry+="* * */${intervalValue} * * ${script}"
entry+="0 0 */${intervalValue} * * ${script}"
setCronConfig "$entry"
else
eval echo "Invalid unit for system clock check interval." $LOGPIPE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment