git: 498f1c8ed2cf - stable/13 - rc.d/ntpd: Restart ntpd when resuming from sleep.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 13 Jul 2022 16:47:40 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=498f1c8ed2cf0f9748b0b96b197720f1cc45642b

commit 498f1c8ed2cf0f9748b0b96b197720f1cc45642b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-06-14 17:42:51 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 16:19:45 +0000

    rc.d/ntpd: Restart ntpd when resuming from sleep.
    
    ntpd does not always gracefully handle clock steps during resume.
    This is probably most useful in conjunction with
    ntpd_sync_on_start=YES which will work around any clock skew while
    suspended.
    
    Reviewed by:    manu
    Differential Revision:  https://reviews.freebsd.org/D35479
    
    (cherry picked from commit 1442fed7e25e9856464a0b0ce522ffc8cb473593)
---
 libexec/rc/rc.d/ntpd | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libexec/rc/rc.d/ntpd b/libexec/rc/rc.d/ntpd
index c1d2f52a01b7..7c7879583185 100755
--- a/libexec/rc/rc.d/ntpd
+++ b/libexec/rc/rc.d/ntpd
@@ -6,7 +6,7 @@
 # PROVIDE: ntpd
 # REQUIRE: DAEMON ntpdate FILESYSTEMS devfs
 # BEFORE:  LOGIN
-# KEYWORD: nojail shutdown
+# KEYWORD: nojail resume shutdown
 
 . /etc/rc.subr
 
@@ -14,9 +14,10 @@ name="ntpd"
 desc="Network Time Protocol daemon"
 rcvar="ntpd_enable"
 command="/usr/sbin/${name}"
-extra_commands="fetch needfetch"
+extra_commands="fetch needfetch resume"
 fetch_cmd="ntpd_fetch_leapfile"
 needfetch_cmd="ntpd_needfetch_leapfile"
+resume_cmd="ntpd_resume"
 start_precmd="ntpd_precmd"
 
 _ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
@@ -239,4 +240,9 @@ ntpd_fetch_leapfile() {
 	fi
 }
 
+ntpd_resume()
+{
+	run_rc_command restart
+}
+
 run_rc_command "$1"