I am tailing the logs on my log server to display any of them in a window, however when I close my application, the remote tail process remains active on the server.
Repeating produces a huge amount of zombie processes.
process_log_watcher_->start(QString(
"ssh -t %1 \"tail -F -n 0 /var/log/logfile.log\"").arg(log_server_));
In a console, the ssh -t
option handles an exit of the terminal; I want to reproduce that behaviour.
In the destructor I call process_log_watcher_->close();
, but it does not seem to help. It behaves differently from closing a console window with the ssh -t server "tail -F -n 0 /var/log/logfile.log"
started.
Could it be that the QProcess does not terminate the ssh session?
ssh -t server bash -c \"tail -F -n 0 /var/log/logfile.log\"
solves the problem.
That means that the ssh connection termination is not properly forwarded to the tail, but it is correctly forwarded to the remote bash, which then terminated the tail as required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With