Patrick-Dussault

Unix / Linux SSH Window :: Leave a Program Running in the Background even if You Close the SSH Session

Blog Post created by Patrick-Dussault Employee on Dec 23, 2016

If you have launched a program in your PuTtY SSH session on Linux or Unix

box, and unfortunatly, you need to leave and you do not want to interrupt the execution

of the program, you can use the disown command to make your program not get the SIGHUP

when closing the session and keep it running in the background :

 

 

1 - Hit "ctrl+z" to pause the program and get back to the shell;

2 - Type "bg" to run it in the background;

3 - Type "disown -h [job-spec]" where [job-spec] is the job number;

 

To illustrate that :

 

$ XPSImport export.xml -fo -passphrase password -vT -l export.log -e export_error.log

(hit ctrl+z)

[1]+ Stopped XPSImport

$ bg

[1]+ XPSImport &

$ disown -h %1

 

then you can close or exit your session and the process will keep

running on the machine in the background.

Outcomes