#!/usr/local/bin/perl -w # # copymon # # Purpose: # Script to copy new images into the current directory. # # Usage: # copymon # where: # = "lris" or "hires" # # Modification history: # GDW 1998-Jul-28 original version, adapted from "archmon" # GDW 1998-Nov-11 added check on return value of "waitfor" to # enable keyboard interrupts #----------------------------------------------------------------------- { # declare variables... my( $maxhours) = 18; # maximum number of hours to run my( $quitting_time) = 10; # stop after 10am is started before 10am my( @buf); my( $outdir); my( $outfile); my( $frameno); my( $dform); my( $todisk); my( $rootname); my( $filename); my( $nightpath); my( $space); my( $i); my( $size); my( $machine); my( $disk); my( $hh, $hh_start); my( $dd, $dd_start); # verify presence of argument... if ( $#ARGV < 0 ){ die "Usage:\n\tcopymon \nwhere:\n\t = \"hires\" or \"lris\"\007\n" } # verify validity of argument... my( $instrument) = $ARGV[0]; unless ( $instrument eq "hires" || $instrument eq "lris" ){ die ("copymon: invalid instrument name \"", $instrument, "\"\007\n") } # get the current working directory... my( $dir) = `pwd`; chop( $dir); print < $quitting_time && ( $hh_start < $quitting_time || $dd != $dd_start )){ print "copymon: it's after $quitting_time o'clock --- normal exit.\007\n"; last; } # quit if we've been running more than 18 hours... if((time-$^T) > 3600*$maxhours){ print "copymon: program running more than $maxhours hours --- normal exit.\007\n"; last; } # continue iteration of the loop... redo; } }