#! /bin/ksh # ** saveaday.scr ** Just to make a yyddd subdir and copy dated gif files there. # (26sep2001 gsw) # # 27sep2001 -gsw- actually no need at the moment for using yda. # Update: 26sep2001 -gsw- make automatic (either yda(default) or entered day). #----- # Set the path. (setPATH/setMCPATH.scr by JPN) #----- ####export PATH=`setPATH.scr` #----- # Set up MCPATH. #----- ####export MCPATH=`setMCPATH.scr` command=$0 #----- # Display script name as well as time and date at the beginning of the script. #----- echo echo "**********************************************************************" echo echo " ** $command began at ..." echo echo " ** `date -u +\"%T UT on %a %d %b %Y {%j}\"` **" echo # -- If date is entered, use it (yyddd); otherwise, determine yesterday to use # as the default. (Transfers are only to be done after all of a day's # processing would be complete.) if [ -z "$1" ] then let ccyyddd=`date -u +%Y%j` # Determine date for yesterday (with assumed default of today). Only tricks are: # 31 Dec from 1 Jan and back to a leap year-or-not (after a 4-divisible yr). if [ ccyyddd%1000 -eq 1 ] then if [ ccyyddd%4 -eq 1 ] then let lastday=366 else let lastday=365 fi let lastyr=ccyyddd/1000-1 let lastyrx3=lastyr*1000 let ccyyyda=lastyrx3+lastday else let ccyyyda=ccyyddd-1 fi # Make sure yyddd variable, for yesterday, is at least 5 digits wide... # let yyyda=ccyyyda%100000 # -- ...switching date name back to just the one yyddd... cmd="yyddd=\`/home/www/bin/fullnumber.scr $yyyda 5\`" ; eval $cmd echo "($command) Note: using default date (ie, yesterday) of $yyddd" ##### no need for yda computation at the moment; skip its output for now let yyddd=ccyyddd%100000 cmd="yyddd=\`/home/www/bin/fullnumber.scr $yyddd 5\`" ; eval $cmd echo "($command) Note: using default date (ie, still today) of $yyddd" ##### else yyddd=$1 echo "($command) Note: using entered date of $yyddd" fi echo cd /home2/www/goes/realtime/g12/arc mkdir $yyddd # -- copy files from realtime dir to new subdir. cd $yyddd cp ../../*$yyddd*.gif . pwd > readme ls -l >> readme echo " `date -u +\"%T UT on %a %d %b %Y {%j}\"`" >> readme echo "list out what has been copied... " echo cat readme echo echo "**********************************************************************" echo echo " ** $command ended at ..." echo echo " ** `date -u +\"%T UT on %a %d %b %Y {%j}\"` **" echo exit 0