mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: ping fails on servers that don't set PATH in cron (#7603)
* fix: ping fails on servers that don't set PATH in cron Find the full path to fping and persist it in the database. Adds the ability to persist settings with Config::set() * Add ability to set webui settings. No display of for paths, because it would be inconsistent.
This commit is contained in:
committed by
Neil Lathwood
parent
47b999cebd
commit
fb45f00340
@@ -2318,3 +2318,23 @@ function return_num($entry)
|
||||
return $num_response[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate the actual path of a binary
|
||||
*
|
||||
* @param $binary
|
||||
* @return mixed
|
||||
*/
|
||||
function locate_binary($binary)
|
||||
{
|
||||
if (!str_contains($binary, '/')) {
|
||||
$output = `whereis -b $binary`;
|
||||
$target = trim(substr($output, strpos($output, ':') + 1));
|
||||
|
||||
if (file_exists($target)) {
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
return $binary;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user