#!/bin/tcsh
# DO NOT EDIT the /cluster/bin/scripts copy of this file -- 
# edit ~/kent/src/utils/iSync instead.

# $Id: iSync,v 1.6 2007/03/12 21:20:32 fanhsu Exp $

set RUNNING = `ps -ef | grep rsync | grep -v grep | wc -l`

if (${RUNNING} > 0) then
    echo "There are already rsync commands running."
    echo "Wait until those are done to run this again."
    exit 255
endif

set rsync = "rsync -arl --delete --rsh=rsh"

if ($HOST != "kkr1u00.kilokluster.ucsc.edu" && $HOST != "kkr1u00") then
    echo "You must run iSync on kkr1u00.kilokluster.ucsc.edu"
    exit 255
endif
foreach i (kkr3u00 kkr4u00 kkr5u00 kkr6u00 kkr7u00)
    $rsync -q /iscratch/i/ $i\:/iscratch/i/ &
end
$rsync -v /iscratch/i/ kkr2u00:/iscratch/i/
echo waiting for other machines
wait
echo done iSync
