#!/bin/csh -f # # utlogger - execute autolog and make a running log file # using the log name CCYYMMDD.log in UTC time. # # This script executes autolog and make a log file with the # name CCYYMMDD.log in the LogDir directory, where CCYYMMDD # is the UTC Date. This name is autogenerated by querying # the system UTC clock (date -u). If the file already exists, # it executes autolog -H (no header) and appends the log data, # otherwise it generates a header as the first line of the log file. # # If you give no arguments on the command line, it pukes. # If you give it a wildcard argument, it handles it just fine. # # This cript assumes the default format file. If you want to change it, # add the -Ffmtfile flag below. # # Set the LogDir enviroment variable below to set the source # directory. If blank, it will assume the cwd, which might # be bad. # # R. Pogge # OSU Astronomy Dept # pogge@astronomy.ohio-state.edu # 2000 Feb 20 # # CCYYMMDD dates are Y2K compliant. # #--------------------------------------------------------------------------- # These define paths to the AutoLog executables, directory for logfiles, # and the AutoLog format file to use. set AutoBin=/opt/local/pkg/dts/bin set LogDir=/data/Logs set FmtFile=/opt/local/pkg/dts/AutoLog/andicam.fmt # check the command line if ($#argv == 0) then echo "Cannot execute $0 with no arguments" >>! $LogDir/utlogger.err echo "(`date '+%D %T'`) by $USER@$HOST" >>! $LogDir/utlogger.err exit 1 endif # Build a Y2K-compliant CCYYMMDD ITC date tag. This syntax is generic # to both BSD and SysV flavors of Unix. Not all have %Y for date. set yy=`date -u '+%y'` set mm=`date -u '+%m'` set dd=`date -u '+%d'` @ ccyy = $yy + 2000 set LogFile = "$ccyy$mm$dd.log" # If the file exists, append info, otherwise create the file # and put in a header as the first line if (-e $LogDir/$LogFile) then $AutoBin/autolog -H -F$FmtFile $* >>! $LogDir/$LogFile else $AutoBin/autolog -F$FmtFile $* >! $LogDir/$LogFile endif exit