Xref: utzoo comp.unix.wizards:17967 comp.mail.misc:2332 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!bu-cs!bloom-beacon!hstbme.mit.edu!scs From: scs@hstbme.mit.edu (Steve Summit) Newsgroups: comp.unix.wizards,comp.mail.misc Subject: Re: killing bkgnd process on logout Keywords: csh, background process, nohup Message-ID: <14032@bloom-beacon.MIT.EDU> Date: 3 Sep 89 17:21:25 GMT References: <128@isgtec.UUCP> <92@harald.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu (Steve Summit) Lines: 41 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