#!/bin/csh -f ############################################################################# # # This script is called by the pfocus.prg MIDAS program. The script # receives two arguments from pfocus, and records these along with # telescope and environmental parameters in the file $db_file. Arguments # needed for this script are: # # (1) date -- Date (decimal years) of observations # (2) exptime -- DFOSC exposure time # (3) d_filt -- DFOSC filter used for pyramid focus # (4) fa_filt -- FASU B filter used for pyramid focus # (5) fb_filt -- FASU A filter used for pyramid focus # (6) dtelf -- the focus offset needed to correct the focus # (7) camfoc -- DFOSC camera focus # (8) HA -- Hour angle of the telescope # (9) DEC -- Declination of the telescope # (10) ZD -- zenith distance of the telescope # # Author: James Brewer # Version: 1.1 Date: Oct.31, 1998 ############################################################################# # # Check script arguments... # if($#argv != 10) then echo "Usage: $0 date exptime d_filt fa_filt fb_filt dtelf camfoc DEC HA ZD" exit(-1) endif # # Set up variables used by script... # set path = ($path /home/meteolog/bin) # Add in local bin directory set tmp = /home/meteolog/public/foc_tmp # Root for temporary file set db_file = /home/meteolog/public/foc_db.dat # Database file set db_full = 500 # No of entries for a full db set mailto = "jbrewer@eso.org" # Recipients of filled db's # # Create database file if it doesn't exist... # if !(-e $db_file) touch $db_file # # Read the required data... # if (-e $tmp) rm $tmp get_time > $tmp # Read the time from computer echo $1 >> $tmp # Read the time from image echo $2 >> $tmp # DFOSC exposure time echo $3 >> $tmp # DFOSC filter echo $4 >> $tmp # FASU A filter echo $5 >> $tmp # FASU B filter focusValue >> $tmp # Current focus echo $6 >> $tmp # Focus offset echo $7 >> $tmp # DFOSC camera focus echo $8 >> $tmp # Hour angle echo $9 >> $tmp # Declination echo $10 >> $tmp # Zenith Distance foreach n (3 4 9) rdval sens$n | tail -1 | cut -c1-5 >> $tmp # Read sensors end cat $tmp | tr '\n' ' ' >> $db_file echo " " >> $db_file # # If more than $db_full entries in the database, archive and mail it... # set entries = `wc -l $db_file | cut -f1 -d' '` set entries = `expr $entries - 3` if($entries > $db_full) then set ext = ` date | cut -c5-10,24-28 | tr ' ' '_' ` mv $db_file $db_file.$ext echo "DK1p5 Focus Archive" > $tmp.$ext echo "Mail from "$0" on "`hostname` >> $tmp.$ext cat $db_file.$ext >> $tmp.$ext mail $mailto < $tmp.$ext rm $tmp.$ext endif # # Clean up... # rm $tmp exit(1)