Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!ucsd!ucbvax!ucdavis!csus.edu!uop!quack!mrapple From: mrapple@quack.sac.ca.us (Nick Sayer) Newsgroups: comp.unix.programmer Subject: Re: how process in background can kill itself after logout (BSD unix). Message-ID: Date: 30 Jan 91 22:31:10 GMT References: <1991Jan29.012702.7265@nntp-server.caltech.edu> Organization: The Duck Pond, Stockton, CA Lines: 47 fjs@nntp-server.caltech.edu (Fernando J. Selman) writes: >I would like to be able for a process I have running in the >background to kill itself after I logout. I am using BSD unix >in a Sun Sparcserver 490. Because a bug in the OS the process >keep writing to the terminal after I logout. Any help will >be appreciated. You know, what would probably be a better idea would be to fix the bug in SunOS that causes the trouble. It's still present in 4.1.0, and has been around at least since 4.0.0. Any comment from Sun? In the meantime, leaving processes running after logout on modem ports causes very confused gettys to be spawned. You can work around this by "kill -9"ing these bad gettys. Here's a script to do that. You'll need the latest version of sps for this to work right. Run it from cron as often as you like. In the meantime, the only way to run such processes is to use batch/at or cron. Yuckola. ----- cut here ----- #! /bin/sh PATH=/bin:/usr/local/bin:/usr/ucb ; export PATH kill=`sps -va 2>/dev/null | awk ' { if ( ( $2 ~ /\?ty/ ) && ( $10 == "-" ) ) print $9 } '` if [ -z "$kill" ] ; then exit fi echo Killing processes: $kill sps -vp $kill kill -9 $kill exit 0 ----- ereh tuc ----- -- Nick Sayer | Think of me as a recombinant | RIP: Mel Blanc mrapple@quack.sac.ca.us | Simpson: Homer's looks, Lisa's | 1908-1989 N6QQQ [44.2.1.17] | brains, Bart's manners, and | May he never 209-952-5347 (Telebit) | Maggie's appetite for TV. --Me | be silenced.