DRAFT Run FCP scan during diagnostics

Pending Larry approval

Runs FCP scan if one hasn't been already run within 24 hours
This commit is contained in:
Squidly271
2023-10-08 14:11:31 -04:00
committed by GitHub
parent 33ae31abc8
commit b1d874ca85

View File

@@ -50,12 +50,12 @@ function write(...$messages){
}
curl_close($com);
}
function run($cmd, &$save=null) {
function run($cmd, &$save=null, $timeout=30) {
global $cli,$diag;
// output command for display
write($cmd);
// execute command with timeout of 30s
exec("timeout -s9 30 $cmd", $save);
exec("timeout -s9 $timeout $cmd", $save);
return implode("\n",$save);
}
@@ -323,6 +323,12 @@ if ($cli) {
$date = "{$split[2]}-{$split[3]}";
}
// Run Fix Common Problems if present and results are old / not present
if ( is_file("/usr/local/emhttp/plugins/fix.common.problems/scripts/scan.php") ) {
if ( ! is_file("/tmp/fix.common.problems/errors.json") || (time() - filemtime("/tmp/fix.common.problems/errors.json")) > 86400) {
run("/usr/local/emhttp/plugins/fix.common.problems/scripts/scan.php",$ignore,60);
}
}
// don't anonymize system share names
$vardomain = @parse_ini_file('/boot/config/domain.cfg') ?: [];
$vardocker = @parse_ini_file('/boot/config/docker.cfg') ?: [];