Update OpenTerminal.php

This commit is contained in:
bergware
2021-11-11 03:58:00 +01:00
parent 2567f3249a
commit a5bc5b38f5

View File

@@ -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/';