A Sourceful of Secrets

Andrew E. Bruno

Logging out without killing a process

leave a comment »

Here’s the scenario, you’re logged into your favorite *nix box and are using bash as your shell. You fired off some process which is going to take a while to run (and forgot to run screen) and you want to logout without killing that process. The command to use is disown. Here’s a really simple example:

$ ssh some-host
$ perl script-that-chugs-along.pl
$ Ctrl-Z (suspend)
$ bg (put it in background)
$ disown -h
$ logout

The disown command allows you to remove jobs from the list of active jobs associated with your login shell. Here’s an excerpt from the bash man page:

Without options, each jobspec is removed from the table of active jobs. If the -h option is given, the job is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP.

About these ads

Written by Andrew

2010/09/14 at 04:29

Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: