#!/bin/csh -f
if( $#argv == 0 ) then
    usage:
    echo "Usage: $0  {LMHA} [host host...]"
    exit 1
endif
switch ($1)
case "L":
    set  dir = "Low"
    breaksw
case "M":
    set dir = "Mid"
    breaksw
case "H":
    set dir  = "High"
    breaksw
case "A":
    set dir = "All"
    breaksw
default :
    goto usage
    breaksw
endsw

source config


sed s/xxxxx/$dir/ paramFleshContTemp > paramCont

if( $#argv == 1 ) then
    set list = ` cat hostlist `
else
    shift
    set list = `echo $argv[*] `
endif
foreach f($list)
   echo $f
#      see if the progname is still running
   rsh $f  $progdir/bin_execps  $progname > temp$$
   set x = ` awk '{print $1}' temp$$ `
   rm  temp$$
   if( "x"$x != "x" ) then
    echo  "************************************************"
    echo  "programme $progname is currently running on $f"
    echo  "Are you sure this cont job is not interfare with that?" 
    echo  "If you want to run this new cont job, enter 1"
    set ans = $<
    if( $ans != 1) then
       echo "Job submission canceled"
       goto next
    endif
   endif

   rsh $f $progdir/bin_execFleshContnogz $progdir $progname $datadir/$dir &
   sleep 1
   ./bin_killrsh 
next:
end
