As discussed with @JMSolo, here Update breaks Quickbox web and Deluge web
I had an idea to make the processExists function in config.php just make one call to the ps function per user. I had another try at this last night, and got it working. Its not a complicated thing, just php is not a language I write in usually.
Global variables declared at the top.
global $last_user_name;
global $last_process_list;
function processExists($processName, $username) {
global $last_user_name;
global $last_process_list;
$exists = false;
if ($username !== $last_user_name) {
$last_user_name = $username;
exec("ps axo user:20,comm |grep $username | xargs", $result);
$last_process_list = $result[0];
}
if (strpos($last_process_list, $processName) !== false) {
$exists = true;
}
return $exists;
}
I rearranged the list of calls to this function so the same $username is one after another. This reduces the server calls from 17 to 6.
I only have a small VPS, so only Deluge and ruTorrent installed, so it could probably use more testing.
Hope this helps