log off with process running

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Mar 26 04:27:40 PST 2004


On Fri, Mar 26, 2004 at 09:22:48AM +0100, Robert Storey wrote:
> OK, that download might run for hours. I don't want to stay connected for hours,
> I want to log off and hang up the modem. The question is, how to do so? With the
> above process running, I can't even get back to the command line to type "exit"
> (and wouldn't typing "exit" kill any process I'm running?). Ditto if I hit
> ctrl-c. I suppose I could just hang up the modem, but that's not elegant.

Others have posted a number of useful solutions to this sort of
problem.  However all of those solutions require a deal of
forethought.

Suppose you've got a long running process hogging the foreground of
your shell, and you want to background it.  All you need do is hit
Ctrl-Z to stop the process and then 'bg' to restart it in background.
If you've got a lot of jobs running concurrently in a shell you might
need to tell the shell which one to background, which you do by: 'bg
%n' -- 'n' is the job number, as returned by the 'jobs' shell built-in
command.  Putting the process into the background like that is usually
enough to protect the process from being killed when you log out,
although different shells can behave differently in that respect.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040326/f1aed2b8/attachment.bin


More information about the freebsd-questions mailing list