how process in background can kill itself after logout (BSD unix).
Nick Sayer
mrapple at quack.sac.ca.us
Thu Jan 31 09:31:10 AEST 1991
fjs at 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 at 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.
More information about the Comp.unix.programmer
mailing list