Complete.Org: Mailing Lists: Archives: discussion: September 1999:
[aclug-L] Re: A few questions

[aclug-L] Re: A few questions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: [aclug-L] Re: A few questions
From: Carl D Cravens <raven@xxxxxxxxxxx>
Date: Wed, 22 Sep 1999 20:30:12 -0500 (CDT)
Reply-to: aclug-L@xxxxxxxxxxxx

On Wed, 22 Sep 1999, Bob Bonfield wrote:

> Alright, that got it working.  If I log out of the user and try to telnet
> into it remotely will the job still run properly?

That's because when you log out, a HUP (hang-up) signal is sent to every
process you started in that session, which generally tells the program to
terminate.  Normally, this is a good thing so that you don't leave a bunch
of programs around every time you exit the shell without explicitly
terminating all your jobs. 

Look at the manpage on "nohup", which allows you to start commands in such
a way that they'll ignore the HUP signal.  (Alternately, if you're writing
the program yourself, you can initialize the signal handler and have the
program catch the HUP signal on its own.  Daemons do this, for instance.  
Traditionally, many daemons will reload the configuration file when they
receives a HUP.) The drawback here is that nohup doesn't allow you to do
anything interactive with the program... it redirects output to a file

Additionally, starting a program with an ampersand (&) as the last option
on the line will cause the shell to background the process in a running
state immediately.  Unlike using ^Z, the process is never suspended with
this feature.


% nohup mycommand & 

Will run mycommand in the background, immune to HUP signals. 

For further reading, see the manpages on kill, signal(7) (if you "man
signal" you'll get the section 2 page... you want section 7, "man 7
signal"), and possibly signal(2), if you're interested in the C signal

Carl D Cravens (raven@xxxxxxxxxxx)
You can tell the nature of a man by the words he chooses.
   -Dr. Ed Cole

[Prev in Thread] Current Thread [Next in Thread]