From 652cf082209f04b805d0d823fe30a006c2996643 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 20 Feb 2007 08:08:04 +0000 Subject: force a time sync early in the boot before we start any services. This especially important for dhcp when used in failover. Let NTPd keep the time in sync. --- etc/inc/system.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'etc/inc/system.inc') diff --git a/etc/inc/system.inc b/etc/inc/system.inc index c8bec4d..2841648 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1026,6 +1026,20 @@ function system_ntp_configure() { } +function sync_system_time() { + global $config, $g; + + $syscfg = $config['system']; + + if ($g['booting']) + echo "Syncing system time before startup ..."; + + /* foreach through servers and write out to ntpd.conf */ + foreach (explode(' ', $syscfg['timeservers']) as $ts) { + mwexec("/usr/sbin/ntpdate -s $ts"); + } +} + function system_halt() { global $g; @@ -1212,4 +1226,4 @@ function enable_watchdog() { } } -?> \ No newline at end of file +?> -- cgit v1.1