re: How to keep a process running even after closing SSH connection? VIEW POST


Why not just: CTRL+Z -> bg -> disown? Sure, it suspends your job for a moment but in most cases that is not a problem.


Why not add & to the command to start detached, get the pid and disown in a single command. Your job doesn't get stopped, you don't lose anything (if you're capturing packets or doing something timing-critical).


I also use this a lot for jobs that are already started and don't want to lose because of some disconnection.
On a day-to-day basis it's a fair fight between screen, mostly for when I didn't had time to take too much care of the logging, and nohup + disown otherwise, because I like to avoid the hassle of cleaning old screen sessions.


This is a valid point, but I'm afraid that if you do that the jobs that you have in your background would be stopped once you close your SSH session.

Also you would not want to interrupt a critical database import by suspending the job.


From my experience it doesn't get stopped. One more downside is that you can not own it again. It's like fire and forget kind of solution. Upside is that you do not have to have any preparation for it like in other cases, you run commands as usual.

Ah yes, I've just tested that and indeed you are right!

code of conduct - report abuse