d.mon (fwd)

From: STE077@ZAM001.ZAM.KFA-JUELICH.DE (Ralf Kunkel)
Message-ID: <199406151611.LAA06743@max.cecer.army.mil>

Regarding your note to kill the monitor using the PS and KILL command. At
least on our system the GRASS monitor doesn't appear in the task list.
Therefore, it is not possible to kill it this way.
Maybe this is not the "default" behavior, but in this case something in OUR
system is wrong (which could be the case).

Ralf Kunkel

This is a bourne shell script I devised. I will not take responsibility
for misuse. This is a brute force method. Your mileage may vary.
Beware the jabberwok. I probably should have added something to
intelligent remove the 'lock' files.

Chris Rewerts

-------------------------begin script-----------------------------------------
:
#
# this is to make sure all the monitors are dead
# should be used as a last resort. will seek and destroy all the monitors
# a user has running and kill them. who knows, may kill other things, too

# ask d.mon for a list of all monitors, for each we grab its name
# then loop through that list. for each one, we seek the name in
# the users process table. we make sure the process is indeed running
# with a fifo to help preclude killing a coincidental name, then
# we keeeeeell it.

for i in `d.mon -l | awk ' NR > 2 {printf("%s\n", $1)}'`
do

kill -9 `ps -x | grep $i | grep -v grep | grep fifo | awk '{print $1}'` 1> /dev/null 2> /dev/null

done

# unset the MONITOR variable
g.gisenv MONITOR=
-------------------------end script-----------------------------------------