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 ...@@ -935,6 +935,9 @@ choice SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_UNIT
default SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES default SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES
help help
Defines the unit used for the check interval value. 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 config SNMP_SYSTEM_CLOCK_UNIT_MINUTES
bool "Minutes" bool "Minutes"
...@@ -943,36 +946,45 @@ config SNMP_SYSTEM_CLOCK_UNIT_HOURS ...@@ -943,36 +946,45 @@ config SNMP_SYSTEM_CLOCK_UNIT_HOURS
bool "Hours" bool "Hours"
config SNMP_SYSTEM_CLOCK_UNIT_DAYS config SNMP_SYSTEM_CLOCK_UNIT_DAYS
bool "Days " bool "Days"
endchoice endchoice
config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_MINUTES
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_MINUTES depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_MINUTES
int "Interval to verify system clock (Minutes)" int "Interval to verify system clock (Minutes)"
range 1 59 range 1 30
default 10 default 10
help help
Sets the time interval between checks of the system clock. Sets the time interval between checks of the system clock.
This interval is expressed in minutes. 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 config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_HOURS
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_HOURS depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_HOURS
int "Interval to verify system clock (Hours)" int "Interval to verify system clock (Hours)"
range 1 23 range 1 12
default 1 default 1
help help
Sets the time interval between checks of the system clock. Sets the time interval between checks of the system clock.
This interval is expressed in hours. 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 config SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_DAYS
depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_DAYS depends on SNMP_SYSTEM_CLOCK_MONITOR_ENABLED && SNMP_SYSTEM_CLOCK_UNIT_DAYS
int "Interval to verify system clock (Days)" int "Interval to verify system clock (Days)"
range 1 31 range 1 16
default 1 default 1
help help
Sets the time interval between checks of the system clock. Sets the time interval between checks of the system clock.
This interval is expressed in days This interval is expressed in days
Written to cron config file as:
0 0 */val * *
Check cron manual for more details.
endmenu endmenu
......
...@@ -240,14 +240,14 @@ if [ "$#" -eq 1 ] && [ "$1" == "-s" ] ; then ...@@ -240,14 +240,14 @@ if [ "$#" -eq 1 ] && [ "$1" == "-s" ] ; then
intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_HOURS intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_HOURS
debug "Time interval: ${intervalValue} hours" debug "Time interval: ${intervalValue} hours"
entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} hour(s)${NEWLINE}" entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} hour(s)${NEWLINE}"
entry+="* */${intervalValue} * * * ${script}" entry+="0 */${intervalValue} * * * ${script}"
setCronConfig "$entry" setCronConfig "$entry"
else else
if [ "$CONFIG_SNMP_SYSTEM_CLOCK_UNIT_DAYS" = "y" ]; then if [ "$CONFIG_SNMP_SYSTEM_CLOCK_UNIT_DAYS" = "y" ]; then
intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_DAYS intervalValue=$CONFIG_SNMP_SYSTEM_CLOCK_CHECK_INTERVAL_DAYS
debug "Time interval: ${intervalValue} days" debug "Time interval: ${intervalValue} days"
entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} day(s)${NEWLINE}" entry="# System clock monitor: Execute the script \"${script}\" every ${intervalValue} day(s)${NEWLINE}"
entry+="* * */${intervalValue} * * ${script}" entry+="0 0 */${intervalValue} * * ${script}"
setCronConfig "$entry" setCronConfig "$entry"
else else
eval echo "Invalid unit for system clock check interval." $LOGPIPE 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