|
From: <abe...@us...> - 2016-12-01 18:19:03
|
Revision: 8004
http://sourceforge.net/p/astlinux/code/8004
Author: abelbeck
Date: 2016-12-01 18:19:01 +0000 (Thu, 01 Dec 2016)
Log Message:
-----------
web interface, Status, Network, Edit, Prefs, System tabs, add support for 'chrony' instead of 'ntp' for network time
Modified Paths:
--------------
branches/1.0/package/webinterface/altweb/admin/edit.php
branches/1.0/package/webinterface/altweb/admin/network.php
branches/1.0/package/webinterface/altweb/admin/prefs.php
branches/1.0/package/webinterface/altweb/admin/system.php
branches/1.0/package/webinterface/altweb/admin/view.php
branches/1.0/package/webinterface/altweb/common/functions.php
branches/1.0/package/webinterface/altweb/common/license-packages.txt
branches/1.0/package/webinterface/altweb/common/status.inc
Modified: branches/1.0/package/webinterface/altweb/admin/edit.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/edit.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/admin/edit.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -61,7 +61,7 @@
'dnsmasq.conf' => 'DNSmasq Configuration',
'misdn-init.conf' => 'mISDN Configuration',
'msmtp-aliases.conf' => 'SMTP Local Aliases',
- 'ntpd.conf' => 'NTP Time Client/Server',
+ 'chrony.conf' => 'NTP Time Client/Server',
'sshd.conf' => 'SSH Server sshd_config',
'ldap.conf' => 'LDAP Client System Defaults',
'slapd.conf' => 'LDAP Server Configuration',
Modified: branches/1.0/package/webinterface/altweb/admin/network.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/network.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/admin/network.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -927,7 +927,7 @@
}
} elseif (isset($_POST['submit_edit_ntp'])) {
$result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE);
- if (is_writable($file = '/mnt/kd/ntpd.conf')) {
+ if (is_writable($file = '/mnt/kd/chrony.conf')) {
header('Location: /admin/edit.php?file='.$file);
exit;
}
@@ -1698,7 +1698,7 @@
putHtml('</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">');
putHtml('NTP Server:');
- if (! is_file('/mnt/kd/ntpd.conf')) {
+ if (! is_file('/mnt/kd/chrony.conf')) {
if (($t_value = getVARdef($db, 'NTPSERVS', $cur_db)) === '') {
$t_value = getVARdef($db, 'NTPSERV', $cur_db);
}
Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/prefs.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -588,7 +588,7 @@
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
$sel = (getPREFdef($global_prefs, 'status_ntp_sessions') !== 'no') ? ' checked="checked"' : '';
- putHtml('<input type="checkbox" value="ntp_sessions" name="ntp_sessions"'.$sel.' /></td><td colspan="5">Show NTP Peer States</td></tr>');
+ putHtml('<input type="checkbox" value="ntp_sessions" name="ntp_sessions"'.$sel.' /></td><td colspan="5">Show NTP Time Sources</td></tr>');
putHtml('<tr class="dtrow1"><td style="text-align: right;">');
$sel = (getPREFdef($global_prefs, 'status_show_dhcp_leases') !== 'no') ? ' checked="checked"' : '';
putHtml('<input type="checkbox" value="dhcp_leases" name="dhcp_leases"'.$sel.' /></td><td colspan="5">Show DHCP Leases</td></tr>');
Modified: branches/1.0/package/webinterface/altweb/admin/system.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/system.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/admin/system.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -632,10 +632,8 @@
if (is_file($file = '/mnt/kd/crontabs/root')) {
putHtml('<option value="'.$file.'">Cron Jobs for root</option>');
}
- if (is_file($file = '/mnt/kd/ntpd.drift')) {
+ if (is_file($file = '/var/lib/ntp/chrony.drift')) {
putHtml('<option value="'.$file.'">NTP drift file</option>');
- } elseif (is_file($file = '/var/db/ntpd.drift')) {
- putHtml('<option value="'.$file.'">NTP drift file</option>');
}
if (is_file($file = '/etc/udev/rules.d/70-persistent-net.rules')) {
putHtml('<option value="'.$file.'">Net Interface Rules</option>');
Modified: branches/1.0/package/webinterface/altweb/admin/view.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/view.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/admin/view.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -50,7 +50,7 @@
$dir === '/etc/dahdi' ||
$file === '/etc/ssh/sshd_config' ||
$file === '/stat/etc/rc.conf' ||
- $file === '/var/db/ntpd.drift' ||
+ $file === '/var/lib/ntp/chrony.drift' ||
$file === '/etc/udev/rules.d/70-persistent-net.rules' ||
($dir === '/etc' && (substr($file, -5) === '.conf'))) {
if (is_file($file)) {
Modified: branches/1.0/package/webinterface/altweb/common/functions.php
===================================================================
--- branches/1.0/package/webinterface/altweb/common/functions.php 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/common/functions.php 2016-12-01 18:19:01 UTC (rev 8004)
@@ -123,6 +123,12 @@
} else {
$str = $stopped;
}
+ } elseif ($process === 'ntpd') {
+ if (is_file($path.'chronyd.pid')) {
+ $str = $running;
+ } else {
+ $str = $stopped;
+ }
} elseif ($process === 'ipsec') {
if (is_file($path.'charon.pid')) {
$str = $running;
@@ -181,7 +187,7 @@
function systemREBOOT($myself, $result, $setup = FALSE) {
global $global_prefs;
- $count_down_secs = 120;
+ $count_down_secs = 125;
if (($adjust = getPREFdef($global_prefs, 'system_reboot_timer_adjust')) !== '') {
$count_down_secs += (int)$adjust;
@@ -552,8 +558,8 @@
$value = trim($value, ' ');
}
if ($var === 'NTPSERV' || $var === 'NTPSERVS') {
- if (is_file('/mnt/kd/ntpd.conf')) {
- $value = '#NTP server is specified in /mnt/kd/ntpd.conf';
+ if (is_file('/mnt/kd/chrony.conf')) {
+ $value = '#NTP server is specified in /mnt/kd/chrony.conf';
}
}
if ($var === 'UPS_DRIVER' || $var === 'UPS_DRIVER_PORT') {
Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt
===================================================================
--- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2016-12-01 18:19:01 UTC (rev 8004)
@@ -20,7 +20,6 @@
OpenSSH~Copyright (c) 1995-2015 Tatu Ylonen, Espoo, Finland. All rights reserved.
OpenVPN~Copyright (c) 2002-2016 OpenVPN Technologies, Inc.
PHP~Copyright (c) 1999-2016 The PHP Group. All rights reserved.
-ntpd~Copyright (c) 1992-2016 David L. Mills.
vsftpd~Copyright (c) 2001-2015 Daniel Jacobowitz.
lighttpd~Copyright (c) 2004-2016 Jan Kneschke.
msmtp~Copyright (c) 2000-2016 Martin Lambers.
@@ -64,3 +63,4 @@
Linux Kernel~Copyright (c) 1997-2016 The Linux Kernel Organization, Inc.; Linux is a Registered Trademark of Linus Torvalds.
whois~Copyright (c) 1999-2016 Marco d'Itri.
strongSwan~Copyright (c) 2006-2016 Andreas Steffen, Tobias Brunner, et al.
+chrony~Copyright (c) 2009-2016 Miroslav Lichvar.
Modified: branches/1.0/package/webinterface/altweb/common/status.inc
===================================================================
--- branches/1.0/package/webinterface/altweb/common/status.inc 2016-12-01 16:09:41 UTC (rev 8003)
+++ branches/1.0/package/webinterface/altweb/common/status.inc 2016-12-01 18:19:01 UTC (rev 8004)
@@ -36,6 +36,7 @@
// 10-28-2014, Added S.M.A.R.T Monitoring Status
// 11-06-2014, Added Failover Status
// 10-14-2016, Added Check for default admin password
+// 12-01-2016, Added chronyc to replace ntpq
//
// System location of OpenVPN Client logfile
$OVPNCLOGFILE = '/var/log/openvpnclient-status.log';
@@ -73,7 +74,7 @@
function getDaemons() {
$status['asterisk'] = 0;
- $status['ntpd'] = 0;
+ $status['chronyd'] = 0;
$status['miniupnpd'] = 0;
$status['dnsmasq'] = 0;
$status['openvpn'] = 0;
@@ -705,24 +706,20 @@
}
}
-if ($daemon['ntpd'] > 0) {
+if ($daemon['chronyd'] > 0) {
if (getPREFdef($global_prefs, 'status_ntp_sessions') !== 'no') {
- putHtml("<h2>NTP Peer States:</h2>");
+ putHtml("<h2>NTP Time Sources:</h2>");
putHtml("<pre>");
- $tmpfile = tempnam("/tmp", "PHP_");
- shell('ntpq -pn 127.0.0.1 >'.$tmpfile, $status);
- if ($status == 0) {
- $ph = @fopen($tmpfile, "r");
- while (! feof($ph)) {
- if (($line = rtrim(fgets($ph, 1024))) !== '') {
- putText($line);
- }
- }
- fclose($ph);
- } else {
- putText('No NTP peers found');
+
+ $output = array();
+ @exec('/usr/bin/chronyc sources', $output);
+ if (strncmp(current($output), '210', 3) == 0) {
+ array_shift($output); // Skip first '210' line
}
- @unlink($tmpfile);
+ foreach ($output as $line) {
+ putText(rtrim($line));
+ }
+ unset($output);
putHtml("</pre>");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|