summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/system.inc16
-rwxr-xr-xetc/rc.bootup5
2 files changed, 19 insertions, 2 deletions
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
+?>
diff --git a/etc/rc.bootup b/etc/rc.bootup
index 1c251d5..3a02f57 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -140,6 +140,9 @@
/* generate resolv.conf */
system_resolvconf_generate();
+ /* Sync the system time at boot before service startup */
+ sync_system_time();
+
/* configure loopback interface */
interfaces_loopback_configure();
@@ -312,4 +315,4 @@
unlink("{$g['varrun_path']}/booting");
$g['booting'] = FALSE;
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud