Check to see if posix_getsid exists

This commit is contained in:
FusionPBX 2022-09-12 20:49:04 -06:00 committed by GitHub
parent 7d641711fc
commit 694fa611ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 5 deletions

View File

@ -58,13 +58,25 @@
//check to see if the process is running //check to see if the process is running
if (file_exists($file)) { if (file_exists($file)) {
$pid = file_get_contents($file); $pid = file_get_contents($file);
if (posix_getsid($pid) === false) { if (function_exists('posix_getsid')) {
//process is not running if (posix_getsid($pid) === false) {
$exists = false; //process is not running
$exists = false;
}
else {
//process is running
$exists = true;
}
} }
else { else {
//process is running if (file_exists('/proc/'.$pid)) {
$exists = true; //process is running
$exists = true;
}
else {
//process is not running
$exists = false;
}
} }
} }