Skip to content

check-date-http

https://github.com/libremesh/lime-packages/blob/master/packages/check-date-http

Readme

# check-date-http

NTP daemon shipped with busybox is not capable to gracefully handle cases of extreme time skew, that are common enough in some community networks, this package detect that situation and restart sysntpd and/or reset the date depending on the configuration.

Check local time against a list of HTTP(s) services, if the time skew is more then 15 minutes, restart sysntpd to force time syncronization, or reset trought date command depending on configuration.

## Configurations
You can change the behavior and the list of servers in /etc/config/check-date

Makefile

#
# Copyright (C) 2019 Gioacchino Mazzurco <gio@altermundi.net>
#
# This is free software, licensed under the GNU Affero General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=check-date-http
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
	TITLE:=Keep local date under NTP too far away skew
	CATEGORY:=LibreMesh
	MAINTAINER:=Gioacchino Mazzurco <gio@altermundi.net>
	URL:=http://libremesh.org
	DEPENDS:=+libuci-lua +lua +random-numgen \
		+luci-lib-httpclient
	PKGARCH:=all
endef

define Package/$(PKG_NAME)/description
	Check local time against a list of HTTP(s) services, if the time skew is
	more then 15 minutes, restart sysntpd to force time syncronization, or
	reset trought date command depending on configuration.
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/
	$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))