Running a command in background?
Aaron Howell
aaron at kitten.net.au
Tue Jun 18 19:11:45 EDT 2002
Its actually shell dependent.
Bash will warn you if you are a normal user, and kill your jobs if you don't use nohup.
(what nohup actually does is prevent any process running under it from receiving the hangup (HUP) signal.).
When you exit most shells they send any processes running under them the HUP signal
which tells the process, exit as soon as you can please.
Its a nicer way of telling processes to go away than sending term or kill which happens at system shutdown.
When you're writing an application which handles signals, you can ignore any except a select few
(under linux I believe its SIGKILL and SIGSEGV).
So nohup just swallows the hup signal sent by the shell when you log out and allows the child process to continue to run.
(Oh, and the reason for nohup.out? that's because if the process was still attached to the tty when you logged out, it would (depending how well its coded), sit and block trying to write to the tty which it no longer owns, or die with EPERM, or do something else random.
Those who've been with linux for more than about 5 years will remember that if you got disconnected from a linux system running curses based applications like pine or ncftp, when you logged back in you'd find the offending process still there and using up most of your cpu).
Anyway, I'm pretty sure most of the above is accurate historically and helps to explain why things are as they are with respect to job control and logging out.
Regards
Aaron
On Tue, Jun 18, 2002 at 05:03:13PM -0500, Adam Myrow wrote:
> I know that on non-Linux systems, if you try to exit while you have a
> running job in the background, you get a warning saying "you have running
> jobs." If you try to exit again, the job is killed. That's why it's a
> good idea to use nohup on those systems, and I figure it can't hurt on
> Linux. By non-Linux, I mean other Unix variants like Solaris.
>
>
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
--
+----------------------------------------------------------+
/ |\ _,,,---,,_ /|
/ /,`.-'`' -. ;-;;,_ / |
/ |,4- ) )-,_. ,\ ( `'-' / |
/ '---''(_/--' `-'\_) / |
+----------------------------------------------------------+ |
| Aaron Howell Kitten Internet | |
| aaron at kitten.net.au Internet consultancy, | |
| Phone: +61-417-625550 System administration, | |
| fax: +61-7-36010099 system design/integration. | |
| icq: 6715521 http://www.kitten.net.au | |
| | |
| | +
| | /
| | /
| | /
| |/
+----------------------------------------------------------+
More information about the Speakup
mailing list