[comp.windows.x] Shell script for killing uwm

Timothy.Freeman@THEORY.CS.CMU.EDU.UUCP (02/16/87)

Here's a little shell script we use to kill uwm when we want to.  We
tell uwm to invoke it when we select "quit" from a menu.

#! /bin/csh -f
#
# Author: Tim Freeman, with thanks to Frank Pfenning
#
set FINDPROC = /usr/local/lib/uwmproc.awk

set uwmproc = `ps -acx | awk -f $FINDPROC`
if ($uwmproc == "") then
	echo "No window manager found.">/dev/tty
  else
	kill -9 $uwmproc
	if ( $status == 1 ) then
		echo "Failed to kill window manager.">/dev/tty
	   endif
  endif

Here's the file /usr/local/lib/uwmproc.awk:

$5 == "uwm" { print $1 }

I could have changed uwm to have a f.quit, but this this has the
advantage that we will probably be able to move to the next version of
X without having to install our own changes.  It would be better if uwm
had a f.quit, right?

wohler@SPAM.ISTC.SRI.COM.UUCP (02/16/87)

  here's a couple of recommendations:
  
>set uwmproc = `ps -acx | awk -f $FINDPROC`

  save yourself a file and use:

	set uwmproc = `ps -g | awk '$5 == "uwm" {print $1}'`

  also note that i used ps -g; you're not interested in someone else's
  uwm.  

  don't use kill -9 unless it's necessary (like a login shell).  give
  the program and operating system a chance to clean up.  for
  instance, gnuemacs will autosave any unwritten buffers if sent a
  SIGTERM signal (kill's default).

							--bw