#!/bin/csh ############################################################################# # Copyright: J.Brewer/ESO 1999.############################################## ############################################################################# # # Name: ObsLogN # Description: This script will create a catalogue of FITS files # which exist in the calling directory, and then append to this # catalogue as new files arrive. This script is terminated by an # interrupt (^c) upon which an option is given to print the catalogue. # # # Author: James Brewer, jbrewer@eso.org # Version: 1.0, 5 May99: First release # ############################################################################# # # Check script arguments... # if($#argv != 0 || $1 == "-help") then goto error endif # # Set path needed for other execs... # set path = ($path ~meteolog/scripts) # # Set variables... # set wait = 3 # Sleep between datafile update checks set tmp = ObsLogN.tmp # Name for a temporary file... # # Define action on interrupt (^c)... # onintr cleanup # # Start the catalogue off with existing files (if any). This call # to ObsLog.csh will also generate the catalogue header. # (ls dfsc*.mt >! $tmp) >& /dev/null while (`cat $tmp | wc -l` == 0) # There are *no* files. Wait a while... echo "Waiting for images to arrive..." sleep $wait (ls dfsc*.mt >! $tmp) >& /dev/null end rm $tmp # # Start catalog with last *few* images (handy in case 1000's of images on disk) # ObsLog.csh `ls dfsc*.mt | tail` # # Start an infinite loop to update catalogue... # while(1) # # Wait until a new data file has arrived... # set last = `ls dfsc*.mt | tail -1` set new = $last while($last == $new) sleep $wait set new = `ls dfsc*.mt | tail -1` end # # A new file has arrived -- wait for the permission to be set... # while !(-r $new) sleep $wait end # # File has arrived, and can be read. Add to the catalogue... # ObsLog.csh -a $new end exit(0) cleanup: # # Call up the log printing command... # ObsLog.prt exit(0) error: echo "Usage: "$0 echo " " echo "[Further information --> "$0" -help]" echo "[See this script --> more `which "$0"`]" if($1 == "-help") then more `echo $0 | sed -e s/ObsLogN/ObsLog.man/` endif exit(-1)