[comp.mail.misc] killing bkgnd process on logout

bmw@isgtec.UUCP (Bruce Walker) (08/31/89)

In article <92@harald.UUCP> jba@harald.ruc.dk (Jan B. Andersen) writes:
>>In article <128@isgtec.UUCP> bmw@isgtec.UUCP (Bruce Walker) writes:
>>[ in BSD systems ]
>>the process
>>disconnects from your tty and continues running ...
>
>This has nothing to do with BSD vs Sys V.
>
>        [CSH man page excerpt deleted]

Well, it sort-of does.  Csh's under SysV are usually sub-sets of full-blown
BSD csh's, and don't behave the same.

I am using csh as implimented by Convergent Technologies' CTIX (essentially
SysV) and csh as implimented by Sun (4.0.1).

If I run my checkmail process in the background from CTIX csh, then log out,
checkmail dies.  If I do that on Sun csh, it behaves as your man page
suggests (ignores SIGHUP).  I suspect that other SysV csh's also behave more
like sh(1) than BSD csh in this regard.
-- 
Bruce Walker                          ...uunet!mnetor!lsuc!isgtec!bmw
"Better Living Through Connectivity"         ...utzoo!lsuc!isgtec!bmw
ISG Technologies Inc. 3030 Orlando Dr. Mississauga. Ont. Can. L4V 1S8

scs@hstbme.mit.edu (Steve Summit) (09/04/89)

In article <128@isgtec.UUCP> bmw@isgtec.UUCP (Bruce Walker) writes:
>You are supposed to start it like this (usually from .login):
>	$ checkmail&
>However, if you do this [under certain job-control csh's], the process
>disconnects from your tty and continues running (inherited by root).
>
>My (slightly klugey) solution is to add a line to my .logout (csh):
>	/bin/kill -9 `ps x | awk '$5=="checkmail" {print $1}'`&
>Anyone know a better way?

In article <92@harald.UUCP> jba@harald.ruc.dk (Jan B. Andersen)
correctly points out that:

>...TFM... says it all:
>     CSH(1B)
>	  Processes running in background (by &) are immune to signals
>	  generated from the keyboard, including hangups.
>
>Personally I find this behavior a bit odd. Why not use nohup(1)
>instead?

I consider this a bug in csh, though most doubtless consider it a
feature.  In the old days, it was considered the exception that a
background job would want to be left running after logout;
therefore, the HUP signal normally killed all processes, and
nohup had to be used explicitly when a background job was to be
left running.  (nohup also attempted to guarantee, in a
simpleminded but effective way, that the background job would not
scribble on the terminal, out of courtesy for the next person to
log in on it.  Now that "everybody" uses csh, nobody uses nohup
and this protection has disappeared, which was probably one
reason Berkeley had to invent vhangup, about which the inimitable
Chris Torek has said, "warning: don't look at [it] immediately
after eating food.")

Would one of the innumerable csh users and/or lovers out there
let this poor fellow know what the appropriate way of having
background demons killed on logout under csh is?  (There is an
appropriate, clean way, right?)

                                                Steve Summit

jbw@bucsf.bu.edu (Joe Wells) (09/04/89)

In article <14032@bloom-beacon.MIT.EDU> scs@hstbme.mit.edu (Steve Summit) writes:
   reason Berkeley had to invent vhangup, about which the inimitable
   Chris Torek has said, "warning: don't look at [it] immediately
   after eating food.")

Here's the correct quote:

  Whoa!  Don't look at vhangup(2) immediately after eating food.
	-- Rick Ace

--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw

argv%turnpike@Sun.COM (Dan Heller) (09/04/89)

In article <37484@bu-cs.BU.EDU> jbw@bucsf.bu.edu (Joe Wells) writes:
> Here's the correct quote:
> 
>   Whoa!  Don't look at vhangup(2) immediately after eating food.
> 	-- Rick Ace

Rick Ace?  The one who works at Pixar now?  He's my next door neighbor!
What a small world...  Isn't life funny... I think I'll walk over there
and have a talk with him about this :-)


dan <island!argv@sun.com>
-----
My postings reflect my opinion only -- not the opinion of any company.