All pastes #675049 Raw Edit

Untitled

public shellscript v1 · immutable
#675049 ·published 2007-08-29 19:44 UTC
rendered paste body
  echo "Querying ${SERVER} to sync files ..."  #connect() doesn't timeout if the end is null routed.. need to simulate alarm/setjmp..  TMPFILE=`mktemp /tmp/rsync.XXXXXX` || exit 1  nc -z ${SERVER}.${DOMAIN} 1023 > $TMPFILE 2> /dev/null &  PID=$!  disown $!  sleep 1  loop=1  while true; do    grep "succeeded" $TMPFILE > /dev/null 2>&1    if [ 0 -eq $? ]; then      break    fi    if [ $loop = $SYNC_TIMEOUT ]; then      break    fi    ((loop++))    sleep 1  done  kill -9 $PID > /dev/null 2>&1  grep "succeeded" $TMPFILE > /dev/null 2>&1  status=$?  rm -f $TMPFILE  if [ 1 -eq $status ]; then    echo "ERROR: ${SERVER} failed to respond."    return 1  fi