diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2007-02-20 08:08:04 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2007-02-20 08:08:04 +0000 |
commit | 652cf082209f04b805d0d823fe30a006c2996643 (patch) | |
tree | 6a1bb70b64274ba4da6bf3fcddba0fe59d814a08 | |
parent | e89124ac81424349af5b7cfcce96aa7a6b6978bd (diff) | |
download | pfsense-652cf082209f04b805d0d823fe30a006c2996643.zip pfsense-652cf082209f04b805d0d823fe30a006c2996643.tar.gz |
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.
-rw-r--r-- | etc/inc/system.inc | 16 | ||||
-rwxr-xr-x | etc/rc.bootup | 5 |
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 +?> |