mirror of
https://github.com/unraid/webgui.git
synced 2026-03-01 05:41:08 -06:00
update diagnostics
- make use of "publish" function - force bash commands to run with UTF8 encoding
This commit is contained in:
@@ -26,7 +26,7 @@ $cli = empty($zip);
|
||||
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/publish.php";
|
||||
|
||||
if (is_file('/boot/syslinux/syslinux.cfg')) {
|
||||
$bootenv = '/boot/syslinux';
|
||||
@@ -45,18 +45,7 @@ $pools = pools_filter($disks);
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
function write(...$messages){
|
||||
$com = curl_init();
|
||||
curl_setopt_array($com,[
|
||||
CURLOPT_URL => 'http://localhost/pub/diagnostics?buffer_length=1',
|
||||
CURLOPT_UNIX_SOCKET_PATH => '/var/run/nginx.socket',
|
||||
CURLOPT_POST => 1,
|
||||
CURLOPT_RETURNTRANSFER => true
|
||||
]);
|
||||
foreach ($messages as $message) {
|
||||
curl_setopt($com, CURLOPT_POSTFIELDS, $message);
|
||||
curl_exec($com);
|
||||
}
|
||||
curl_close($com);
|
||||
foreach ($messages as $message) publish('diagnostics', $message);
|
||||
}
|
||||
|
||||
function run($cmd, &$save=null, $timeout=30) {
|
||||
@@ -64,7 +53,7 @@ function run($cmd, &$save=null, $timeout=30) {
|
||||
// output command for display
|
||||
write($cmd);
|
||||
// execute command with timeout of 30s
|
||||
exec("timeout -s9 $timeout $cmd", $save);
|
||||
exec("LC_ALL=en_US.UTF-8 timeout -s9 $timeout $cmd", $save);
|
||||
return implode("\n",$save);
|
||||
}
|
||||
|
||||
@@ -470,7 +459,7 @@ foreach ($ports as $port) {
|
||||
file_put_contents("/$diag/system/ethtool.txt", "--------------------------------\r\n", FILE_APPEND);
|
||||
}
|
||||
run("ip -br a|todos >".escapeshellarg("/$diag/system/ifconfig.txt"));
|
||||
if (!$all) maskIP("/$diag/system/ifconfig.txt");
|
||||
maskIP("/$diag/system/ifconfig.txt");
|
||||
|
||||
// create system information (suppress errors)
|
||||
run("find /sys/kernel/iommu_groups/ -type l 2>/dev/null|sort -V|todos >".escapeshellarg("/$diag/system/iommu_groups.txt"));
|
||||
|
||||
Reference in New Issue
Block a user