[comp.sys.sgi] Killing mex

RAAS@APLVM.BITNET (Randy Schrickel) (11/18/88)

How can I kill mex automatically when logging out (like something in the
.logout file) ? If mex is left running, anyone can come along and start
a new shell as the old user -- doesn't this seem to be a real problem ?!

Thanx

blbates@AERO4.LARC.NASA.GOV (Bates TAD/HRNAB ms294 x2601) (11/18/88)

     Here is a .logout file that I use:

clear
ismex
if($status == 1 && `tty` == '/dev/console') then
   kill -9 `ps x | grep 'clock$' | awk '{print $1}' `
   kill -9 `ps x | grep 'w[0-9]' | grep 'csh (csh)' | awk '{print $1}' `
   kill -9 `ps x | grep 'mex$' | awk '{print $1}' `
endif
if( `tty` == '/dev/console' ) then
   gclear
endif
date

     First it clears the text screen, then it checks to see if mex is
running and if you are on the console.  I usually have the clock running,
so it kills that, next it kills each window (VERY! IMPORTANT).  Then it
kills mex.  If you are on the console it clears the graphics screen.
The if's are very important, if you don't have them and you log off a
remote terminal it messes up the console, especially if someone is using
it.  The order is also important.  If you kill mex with out killing the
other windows first it messes things up.  If you have any questions, let
me know.

P.S. You must compile ismex in the gifts directory.
     /usr/people/gifts/mextools/tools/ismex

willson@GREMLIN.NRTC.NORTHROP.COM (S H Willson) (11/18/88)

    How can I kill mex automatically when logging out (like something in the
    .logout file) ? If mex is left running, anyone can come along and start
    a new shell as the old user -- doesn't this seem to be a real problem ?!

    Thanx

Here is a copy of my .logout.  It does what you want provided you don't
have any extra text windows around (i.e., more than the console window).

-- cut here --
if ($term == wsiris) clear
ismex
if ($status == 1 && `tty` == "/dev/console") then
	# Kill off mex the hard way
	# This still doesn't get rid of any textports!  *Sigh*
	(sleep 2; kill -9 ` ps x | grep 'mex$' | awk '{print $1}' `) &
endif
echo -n "logout " $user " "; date;
-- cut here --

Stephen Willson
Northrop Research and Technology Center
Palos Verdes, CA  90274

jra@BRL.MIL ("John R. Anderson", VLD/ASB) (11/18/88)

I use the following ".logout" file to kill mex when logging out.  I can't
take credit for it, I got it through INFO-IRIS some time ago.

************************************************
clear
ismex
if ($status == 1 && `tty` == "/dev/console") then
	# Kill off mex the hard way
	# This still doesn't get rid of any textports!  *Sigh*
	(sleep 2; kill -9 ` ps x | grep 'mex$' | awk '{print $1}' `) &
endif
echo -n "logout " $user " "; date;
************************************************


Obviously, you must be running "csh" to use this.

miq@chromavac.SGI.COM (Miq Millman) (11/19/88)

In article <8811171344.aa17426@SMOKE.BRL.MIL>, RAAS@APLVM.BITNET (Randy Schrickel) writes:
> How can I kill mex automatically when logging out (like something in the
> .logout file) ? If mex is left running, anyone can come along and start
> a new shell as the old user -- doesn't this seem to be a real problem ?!
> 
> Thanx


put these lines in a .logout file, but be careful not to logout with more than
the console window open or else you will have to kill your other shells by 
finding them in a ps -aux.

this should do the trick
:::::::::::::
.logout
:::::::::::::
kill -9 `ps -x | awk '/mex/ { print $1 }'` >& /dev/null
gclear
clear
--
"What is the greatest joy?"
	"The joy of duty!"
Miq Millman -- miq@sgi.com or {sun,decwrl,pyramid,ucbvax}!sgi!miq
415 960 1980 x1041 work

ralphw@ius3.ius.cs.cmu.edu (Ralph Hyre) (11/20/88)

Won't mex go away if properly exec'ed from the .login, or are process groups
and such not implemented in SGI's Unix?  On our Suns, we use something like:

if (`tty`=/dev/console) exec xinit (or suntools, as per user preference)
-- 
					- Ralph W. Hyre, Jr.
Internet: ralphw@ius3.cs.cmu.edu    Phone:(412) CMU-BUGS
Amateur Packet Radio: N3FGW@W2XO, or c/o W3VC, CMU Radio Club, Pittsburgh, PA
"You can do what you want with my computer, but leave me alone!8-)"
-- 

blbates@AERO4.LARC.NASA.GOV (Bates TAD/HRNAB ms294 x2601) (11/21/88)

    Your .logout would really do the trick all right.  It would mess him
up.  If someone used that, when ever they closed a mex window they would
kill mex and cause a mess.  That command MUST! be put in an if block
so that it will ONLY be executed from the console window.