Revision 20b90e0a
Added by Scott Ullrich almost 19 years ago
etc/inc/system.inc | ||
---|---|---|
882 | 882 |
|
883 | 883 |
function system_ntp_configure() { |
884 | 884 |
global $config, $g; |
885 |
if(isset($config['system']['developerspew'])) { |
|
886 |
$mt = microtime(); |
|
887 |
echo "system_ntp_configure() being called $mt\n"; |
|
888 |
} |
|
889 | 885 |
|
890 | 886 |
$syscfg = $config['system']; |
891 | 887 |
|
892 |
if ($g['booting'])
|
|
893 |
echo "Starting NTP client...";
|
|
894 |
else {
|
|
895 |
killbypid("{$g['varrun_path']}/runmsntp.pid");
|
|
896 |
killbypid("{$g['varrun_path']}/msntp.pid");
|
|
888 |
/* open configuration for wrting or bail */
|
|
889 |
$fd = fopen("{$g['varetc_path']}/ntpd.conf","w");
|
|
890 |
if(!$fd) {
|
|
891 |
log_error("Could not open {$g['varetc_path']}/ntpd.conf");
|
|
892 |
return;
|
|
897 | 893 |
} |
898 | 894 |
|
899 |
/* start ntp client if needed - needs to be forced into background */ |
|
900 |
$updateinterval = $syscfg['time-update-interval']; |
|
895 |
fwrite($fd, "# \n"); |
|
896 |
fwrite($fd, "# pfSense OpenNTPD configuration file \n"); |
|
897 |
fwrite($fd, "# \n\n"); |
|
901 | 898 |
|
902 |
if ($updateinterval > 0) { |
|
903 |
if ($updateinterval < 6) |
|
904 |
$updateinterval = 6; |
|
899 |
/* foreach through servers and write out to ntpd.conf */ |
|
900 |
$timeservers = ""; |
|
901 |
foreach (explode(' ', $syscfg['timeservers']) as $ts) |
|
902 |
fwrite($fd, "servers {$ts}\n"); |
|
905 | 903 |
|
906 |
$timeservers = ""; |
|
907 |
foreach (explode(' ', $syscfg['timeservers']) as $ts) |
|
908 |
$timeservers .= " " . gethostbyname($ts); |
|
904 |
fwrite($fd, "\n"); |
|
909 | 905 |
|
910 |
mwexec_bg("/usr/local/bin/runmsntp.sh " . |
|
911 |
escapeshellarg("{$g['varrun_path']}/runmsntp.pid") . " " . |
|
912 |
escapeshellarg("{$g['varrun_path']}/msntp.pid") . " " . |
|
913 |
escapeshellarg($updateinterval) . " " . |
|
914 |
escapeshellarg($timeservers)); |
|
915 |
} |
|
906 |
/* slurp! */ |
|
907 |
fclose($fd); |
|
908 |
|
|
909 |
/* if openntpd is running, kill it */ |
|
910 |
if(is_process_running("ntpd")) |
|
911 |
exec("/usr/bin/killall ntpd"); |
|
912 |
|
|
913 |
/* start opentpd, set time now and use /var/etc/ntpd.conf */ |
|
914 |
exec("/usr/local/sbin/ntpd -s -f {$g['varetc_path']}/ntpd.conf"); |
|
916 | 915 |
|
917 |
if ($g['booting']) |
|
918 |
echo "done.\n"; |
|
919 | 916 |
} |
920 | 917 |
|
921 | 918 |
function system_halt() { |
etc/rc.bootup | ||
---|---|---|
234 | 234 |
services_proxyarp_configure(); |
235 | 235 |
|
236 | 236 |
/* start the NTP client */ |
237 |
echo "Starting OpenNTP time client..."; |
|
237 | 238 |
system_ntp_configure(); |
239 |
echo "done.\n"; |
|
238 | 240 |
|
239 | 241 |
/* setup pppoe and pptp */ |
240 | 242 |
vpn_setup(); |
usr/local/www/system.php | ||
---|---|---|
124 | 124 |
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']); |
125 | 125 |
|
126 | 126 |
/* pfSense themes */ |
127 |
update_if_changed("System Theme", $config['theme'], $_POST['theme']);
|
|
127 |
update_if_changed("System Theme", $config['theme'], $_POST['theme']); |
|
128 | 128 |
|
129 | 129 |
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */ |
130 | 130 |
unset($config['system']['dnsserver']); |
... | ... | |
134 | 134 |
$config['system']['dnsserver'][] = $_POST['dns2']; |
135 | 135 |
|
136 | 136 |
$olddnsallowoverride = $config['system']['dnsallowoverride']; |
137 |
|
|
137 |
|
|
138 | 138 |
unset($config['system']['dnsallowoverride']); |
139 | 139 |
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false; |
140 | 140 |
if ($_POST['password']) { |
141 | 141 |
$config['system']['password'] = crypt($_POST['password']); |
142 | 142 |
update_changedesc("password changed via webConfigurator"); |
143 |
sync_webgui_passwords();
|
|
143 |
sync_webgui_passwords(); |
|
144 | 144 |
} |
145 | 145 |
|
146 | 146 |
if ($changecount > 0) |
... | ... | |
260 | 260 |
</select> <br> <span class="vexpl">Select the location closest |
261 | 261 |
to you</span></td> |
262 | 262 |
</tr> |
263 |
<!-- |
|
263 | 264 |
<tr> |
264 | 265 |
<td width="22%" valign="top" class="vncell">Time update interval</td> |
265 | 266 |
<td width="78%" class="vtable"> <input name="timeupdateinterval" type="text" class="formfld" id="timeupdateinterval" size="4" value="<?=htmlspecialchars($pconfig['timeupdateinterval']);?>"> |
266 | 267 |
<br> <span class="vexpl">Minutes between network time sync.; |
267 | 268 |
300 recommended, or 0 to disable </span></td> |
268 | 269 |
</tr> |
270 |
--> |
|
269 | 271 |
<tr> |
270 | 272 |
<td width="22%" valign="top" class="vncell">NTP time server</td> |
271 | 273 |
<td width="78%" class="vtable"> <input name="timeservers" type="text" class="formfld" id="timeservers" size="40" value="<?=htmlspecialchars($pconfig['timeservers']);?>"> |
... | ... | |
275 | 277 |
</tr> |
276 | 278 |
<tr> |
277 | 279 |
<td colspan="2" class="list" height="12"> </td> |
278 |
</tr>
|
|
280 |
</tr> |
|
279 | 281 |
<tr> |
280 | 282 |
<td colspan="2" valign="top" class="listtopic">Theme</td> |
281 | 283 |
</tr> |
... | ... | |
299 | 301 |
</select> |
300 | 302 |
<strong>This will change the look and feel of pfSense</strong> |
301 | 303 |
</td> |
302 |
</tr>
|
|
304 |
</tr> |
|
303 | 305 |
<tr> |
304 | 306 |
<td width="22%" valign="top"> </td> |
305 | 307 |
<td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save"> |
Also available in: Unified diff
Switch to OpenNTPD.