#!/bin/csh -f

set path = (/usr/ucb $path)

ps auxww | grep runfactor
ps auxww | grep mpqs

if ( -f /usr/tmp/run-pid.* ) then
set runpid = `cat /usr/tmp/run-pid.* | awk '{print $2}'`
echo killing pid $runpid...
echo `kill $runpid`
endif

if ( -f /usr/tmp/mpqs-pid.* ) then
set mpqspid = `cat /usr/tmp/mpqs-pid.* | grep pid | awk '{print $2}'`
echo killing pid $mpqspid...
echo `kill -CONT $mpqspid`
echo `kill $mpqspid`
endif

sleep 5

ps auxww | grep runfactor
ps auxww | grep mpqs

ls -l /usr/tmp/OUT*
if ( -f /usr/tmp/OUT* ) then
  cat /usr/tmp/OUT* >> /afs/sipb.mit.edu/project/factoring/rsa129/rels/REL.`hostname`
  rm /usr/tmp/OUT*
  endif

exit 0
