#!/bin/tcsh

### Suspends scanning the next file until it looks like the
### automation state machine is idle, then continues.

foreach x (`ls $*`)
  if (-l $x && ! -e `readlink $x`) then
    echo "`date`	Dangling link:  $x"	# Doesn't point anywhere, so can't scan it.
  else
    while ("`find ~/Automation-Notes -type f -mmin -10 -print`" != "")	# Crude but effective.
      sleep 60
    end
    scan-and-notify-on-eas $x cat
    echo "`date`	$x" >>! ~/EAS.scanned
  endif
end
