killall and pgrep updates.

Set --ns $$ on commands.
This commit is contained in:
SimonFair
2024-10-10 19:18:54 +01:00
parent 3c007fa1d0
commit 80d567dfde
25 changed files with 38 additions and 38 deletions

View File

@@ -44,10 +44,10 @@ switch ($_GET['tag']) {
case 'ttyd':
// check if ttyd already running
$sock = "/var/run/ttyd.sock";
exec("pgrep -f '$sock'", $ttyd_pid, $retval);
exec('pgrep --ns $$ -f '."'$sock'", $ttyd_pid, $retval);
if ($retval == 0) {
// check if there are any child processes, ie, curently open tty windows
exec("pgrep -P ".$ttyd_pid[0], $output, $retval);
exec('pgrep --ns $$ -P '.$ttyd_pid[0], $output, $retval);
// no child processes, restart ttyd to pick up possible font size change
if ($retval != 0) exec("kill ".$ttyd_pid[0]);
}