timemngr: run cron job to apply dst

This commit is contained in:
Vivek Kumar Dutta 2024-09-10 16:14:52 +05:30
parent 627a4c4ad6
commit 6a34e2da97
3 changed files with 21 additions and 3 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=timemngr
PKG_VERSION:=1.1.0
PKG_VERSION:=1.1.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -1,5 +1,6 @@
config global 'global'
option enable '1'
option dst '1'
config client 'client'
option enable '1'

View file

@ -19,6 +19,21 @@ validate_global_section() {
'mdns:bool:1'
}
boot() {
config_load time
config_get_bool dst_enable global dst 1
if [ "${dst_enable}" -eq 1 ]; then
if ! grep -qF "#timemngr-dst" /etc/crontabs/root; then
echo "0 0 * * * service system restart #timemngr-dst" >> /etc/crontabs/root
fi
else
sed -i '/#timemngr-dst/d' /etc/crontabs/root
fi
start
}
start_service() {
local enable loglevel server_enable mdns
@ -45,8 +60,10 @@ start_service() {
fi
# Generate Config & Start timemngr instance
generate_config
create_service
if [ "${enable}" -eq 1 ]; then
generate_config
create_service
fi
}
reload_service() {