From 87d86330daf65f95e37809fa26b054e2d280897a Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Fri, 25 Jul 2025 17:27:40 +0700 Subject: [PATCH] added ntpd --- etc/init.d/ntpd | 1 + etc/ntp.conf | 5 +++++ usr/lib/init/services/ntpd.service | 34 ++++++++++++++++++++++++++++++ usr/share/rc/orders | 31 ++++++++++++++------------- 4 files changed, 56 insertions(+), 15 deletions(-) create mode 120000 etc/init.d/ntpd create mode 100644 etc/ntp.conf create mode 100644 usr/lib/init/services/ntpd.service diff --git a/etc/init.d/ntpd b/etc/init.d/ntpd new file mode 120000 index 0000000..585a03d --- /dev/null +++ b/etc/init.d/ntpd @@ -0,0 +1 @@ +../../usr/lib/init/services/ntpd.service \ No newline at end of file diff --git a/etc/ntp.conf b/etc/ntp.conf new file mode 100644 index 0000000..00369ba --- /dev/null +++ b/etc/ntp.conf @@ -0,0 +1,5 @@ +config timeserver 'ntp' + option enabled '1' + option enable_server '0' # Set to '1' to enable NTP server functionality + list server 'pool.ntp.org' + list server 'time.nist.gov' diff --git a/usr/lib/init/services/ntpd.service b/usr/lib/init/services/ntpd.service new file mode 100644 index 0000000..dc87560 --- /dev/null +++ b/usr/lib/init/services/ntpd.service @@ -0,0 +1,34 @@ +#!/bin/sh + +#--- import colors and init-funcs --- +. /usr/lib/init/colors.sh +. /usr/lib/init/init-funcs.sh +#------------------------------------ + +NTPD_OPTS="" + +start() { + notify "Starting ntpd" + /usr/bin/ntpd $NTPD_OPTS + check $? "start ntpd" + echo $(pgrep ntpd) > /var/run/ntpd.pid + return $? +} + +stop() { + notify "Stopping ntpd" + kill $(cat /var/run/ntpd.pid) + check $? "stop ntpd" + rm /var/run/ntpd.pid &> /dev/null + return $? +} + +case "$1" in + start|stop|restart|reload|help) + "$1" + ;; + *) + help + return 1 +esac +return $? diff --git a/usr/share/rc/orders b/usr/share/rc/orders index 9c6ff2d..c9c23e8 100644 --- a/usr/share/rc/orders +++ b/usr/share/rc/orders @@ -4,18 +4,19 @@ 04mdev 05swap 06networking -07netplugd -08sysctl -09crond -10dnsmasq -11dnsd -12telnetd -13sshd -14iptables -15ftpd -16hostapd -17httpd -18nginx -19openrouterinit -20dropbear -21gitea +07ntpd +08netplugd +09sysctl +10crond +11dnsmasq +12dnsd +13telnetd +14sshd +15iptables +16ftpd +17hostapd +18httpd +19nginx +20openrouterinit +21dropbear +22gitea