From a5bc5b38f573ba2cc51e2b3e32bd76f0b77097d8 Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 11 Nov 2021 03:58:00 +0100 Subject: [PATCH] Update OpenTerminal.php --- plugins/dynamix/include/OpenTerminal.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/dynamix/include/OpenTerminal.php b/plugins/dynamix/include/OpenTerminal.php index cc01efdfb..35d45dba7 100644 --- a/plugins/dynamix/include/OpenTerminal.php +++ b/plugins/dynamix/include/OpenTerminal.php @@ -26,11 +26,11 @@ case 'syslog': $path = '/var/log/'; $file = realpath($path.$_GET['name']); $pid = exec("pgrep -a ttyd|awk '/\\/var\\/run\\/syslog.sock:{print \$1}'"); - if ($pid) exec("kill $pid"); - @unlink('/var/run/syslog.sock'); - $command = file_exists($file) ? "tail -n 40 -f '$file'" : "bash --login"; - usleep(100000); - exec("ttyd-exec -o -i '/var/run/syslog.sock' $command"); + if (!$pid) { + @unlink('/var/run/syslog.sock'); + $command = file_exists($file) ? "tail -n 40 -f '$file'" : "bash --login"; + exec("ttyd-exec -o -i '/var/run/syslog.sock' $command"); + } break; case 'log': $path = '/var/log/';