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 /etc/inc | |
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.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/system.inc | 16 |
1 files changed, 15 insertions, 1 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 +?> |