October 05, 2011

Logout without killing running Linux jobs

To logout of your *nix bash session without killing your active jobs is simply done by using either the nohup or disown commands which allow you to leave a job or script running even after you logout.

The syntax is simple:

nohup command-name &

Then type exit or CTRL-D to logout as usual

disown [-ar] [-h] [jobspec ...]
Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used.

If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job.

Share:

0 comments:

Post a Comment