Changeset 12970


Ignore:
Timestamp:
Feb 29, 2012, 12:39:37 PM (8 years ago)
Author:
dorner
Message:
introduced usage of global logfile
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/ZipRawData.sh

    r12760 r12970  
    11#!/bin/bash
    22
    3 today=`date +%F`
    4 logfile=/home/`whoami`/DataCheck/log/ZipRaw$today.log
     3# this script has been written to run on La Palma on the machine data
     4#   i.e. paths are only working on this machine
     5
     6source `dirname $0`/Sourcefile.sh
     7printprocesslog "INFO starting "$0
     8
     9logfile=$runlogpath"/ZipRawLP-"$datetime".log"
     10date >> $logfile
    511
    612# get last 3 nights
     
    1117
    1218# setup to use ftools
    13 export HEADAS=/opt/heasoft-6.11/x86_64-unknown-linux-gnu-libc2.13-0/
    1419source $HEADAS/headas-init.sh
    1520
     
    1823do
    1924   echo "" >> $logfile 2>&1
    20    echo "" >> $logfile 2>&1
    21    echo "" >> $logfile 2>&1
    2225   rawdir=/loc_data/raw/$date
    2326   echo `date`": processing files in "$rawdir >> $logfile 2>&1
     27   printprocesslog "INFO processing files in "$rawdir
    2428   # check if data are available from that night
    2529   if ! [ -d $rawdir ]
    2630   then
    2731      echo `date`": no data available in "$rawdir >> $logfile 2>&1
     32      printprocesslog "INFO no data available in "$rawdir
    2833      continue
    2934   fi
     
    3237   then
    3338      # create output directory for zip
    34       mkdir -pv $zipdir >> $logfile 2>&1
     39      makedir $zipdir >> $logfile 2>&1
    3540   fi
    3641
    3742   # find all fits-files starting with the oldest file
    3843   echo `date`": finding files to be zipped in $rawdir..." >> $logfile 2>&1
     44   printprocesslog "INFO finding files to be zipped in "$rawdir"..."
    3945   fitsfiles=`find $rawdir -type f -name '*fits'| sort `
    4046
     
    4248   then
    4349      echo `date`": no files to be zipped in $rawdir..." >> $logfile 2>&1
     50      printprocesslog "INFO no files to be zipped in "$rawdir"..."
    4451      continue
    4552   fi
     
    4754   # loop to zip files
    4855   echo `date`": zipping files in $rawdir..." >> $logfile 2>&1
     56   printprocesslog "INFO zipping files in "$rawdir"..."
    4957   for file in $fitsfiles
    5058   do
     
    6371      then
    6472         echo $file" is not older than $delaytime min => continue" >> $logfile 2>&1
     73         printprocesslog "INFO "$file" is not older than $delaytime min => continue"
    6574         continue
    6675      fi
     
    7988            # if times are not the same, the file is still open => no zip
    8089            echo `date`": file "$file" not yet closed => continue" >> $logfile 2>&1
     90            printprocesslog "WARN file "$file" not yet closed => continue"
    8191            continue
    8292         fi
     
    8494         # if the origfile doesn't exist, the data was probably written not on daq but on data
    8595         echo `date`": file "$file" was probably taken on data and not daq " >> $logfile 2>&1
     96         printprocesslog "WARN file "$file" was probably taken on data and not daq "
    8697      fi
    8798
     
    99110
    100111      echo `date`": zipping "$file" to "$zipfile" ..." >> $logfile 2>&1
     112      printprocesslog "INFO zipping "$file" to "$zipfile" ..."
    101113      # zip file to stdout and pipe it to outputfile
    102       if pigz -1 -c -f $file > $zipfiletmp;
     114      if pigz -1 -c -f $file > $zipfiletmp
    103115      then
    104116         # if successful, move temporary to final zipfile
     117         printprocesslog "INFO move "$zipfiletmp" to "$zipfile" ..."
    105118         mv -v $zipfiletmp $zipfile >> $logfile 2>&1
    106119      else
    107120         # if not successful, remove temporary zipfile
     121         printprocesslog "INFO remove "$zipfiletmp"..."
    108122         rm -v $zipfiletmp >> $logfile 2>&1
    109123      fi
     
    111125done
    112126echo "finished zipping..." >> $logfile 2>&1
    113 
     127finish
Note: See TracChangeset for help on using the changeset viewer.