[Lunar-commits] <moonbase> ntp: Save system time to hardware clock.
Moritz Heiber
moe at lunar-linux.org
Tue Jul 15 17:53:40 CEST 2008
commit 9a3ef2376f577c4850832c0dc05453b8840906f3
Author: Moritz Heiber <moe at lunar-linux.org>
Date: Tue Jul 15 17:53:40 2008 +0200
ntp: Save system time to hardware clock.
I wanted to do this for a very long time. I'm also working on getting
an initial call to ntpdate into our scripts.
---
net/ntp/init.d/ntpd | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/net/ntp/init.d/ntpd b/net/ntp/init.d/ntpd
index 9638bb6..079c62f 100755
--- a/net/ntp/init.d/ntpd
+++ b/net/ntp/init.d/ntpd
@@ -10,10 +10,26 @@
ARGS="-g"
[ -e "/etc/ntp.conf" ] && ARGS="$ARGS -c /etc/ntp.conf"
+stop () {
+ if [ -x /sbin/hwclock ] ; then
+ # Save the time to hw clock
+ echo -n "Saving system time to hardware clock ... "
+ if /sbin/hwclock --systohc ; then
+ echo -e $RESULT_OK
+ else
+ echo -e $RESULT_FAIL
+ fi
+ else
+ echo -n "hwclock is missing! Can't set hardware clock! "
+ echo -e $RESULT_WARN
+ fi
+ # Stop the real thing
+ default_stop
+}
+
reload () {
# ntp is not reload-safe
$0 restart
}
. /lib/lsb/init-functions
-
More information about the Lunar-commits
mailing list