Newsgroups: comp.parallel.pvm
From: john@elroy.jpl.nasa.gov (John Wright)
Subject: Re: Cleaning up daemons after PVM console failure
Organization: Image Analysis Systems Group, JPL
Date: 13 Apr 1995 14:12:23 GMT
Message-ID: <3mjbg7$dqa@elroy.jpl.nasa.gov>

In article <3mgj8s$i0u@csnews.cs.colorado.edu>,
Christos Triantafill <christos@alumni.cs.colorado.edu> wrote:
>When the PVM console machine fails the remote daemons are left behind
>causing further requests to spawn daemons to be refused from those machines.
>Is there an easy way to clean up all the mess left behind by PVM?
>Has anybody written a cleanup script?
>
>Thanks,
>
>Christos
>
>

There is a script which I believe is packaged with pvm called 
killpvm which does exactly that.  It expects a list of hosts
on the command line and it cleans them all up.  It can accept
a host file using the following command:

killpvm `grep = hostfile | grep "^[A-Za-z0-9]"`

The greps are used to remove the comment lines from the hostfile
before piping it into killpvm.  Just in case you don't have
killpvm it is attached.  It requires that you uncomment the
architecture specific line in the code fragment included in you
.cshrc file as such:

        set path=($path $PVM_ROOT/lib/$PVM_ARCH)  # arch-specific

John

#!/bin/csh
#
# Cleans up the mess after pvm or xpvm crashed.
#   (1) calls pvm on all hosts and gives command 'halt'
#   (2) rm all /tmp/pvm*
#   (3) rm all $TMPDIR/pvm*
#   (4) rm all sockets in $TMPDIR
#
# Any comments to: heimes@@spva.ph.ic.ac.uk
 
#++
# Check if hosts have been listed, complain if not
if ($1 == "") then
  echo 'Usage: killpvm hostname1 hostname2 ...'
  echo '       Give a list of hosts that were involved in the pvm-crash'
  echo '       e.g.: killpvm `cat ../.xpvm_hosts` (if just hostnames in
it)'
  exit
endif
 
#++
# No printing of exit values
unset printexitvalue
 
#++
# Clean up host by host
echo Hosts to check: $*
while ($1 != "")
  echo Checking $1 .....
  rsh $1 -l $USER '                                                \
    if ($PVM_ROOT/lib/$PVM_ARCH/pvm != `which pvm`) then           \
      echo PVM is not properly installed on $HOST \!               \
    else                                                           \
      echo halt | pvm                                >& /dev/null  \
      if ($status) echo Found deserted PVM files - tidying up .... \
      if ($?TMPDIR) then                                           \
      find $TMPDIR/* -type s -exec /bin/rm {} \;     >& /dev/null  \
      endif                                                        \
      /bin/rm /tmp/pvm*                              >& /dev/null  \
      if ($?TMPDIR) then                                           \
      /bin/rm $TMPDIR/pvm*                           >& /dev/null  \
      endif                                                        \
    endif                                                          \
  '
  shift
end


-- 
john@tone.jpl.nasa.gov
---Signature under construction---
(I quail at the impossibility of capturing the 
essence of myself in four lines in an ASCII file)

