source: trunk/DataCheck/Processing/FillRatescans.sh@ 17689

Last change on this file since 17689 was 17597, checked in by Daniela Dorner, 11 years ago
give warning about missing files only when runinfo in DB available
  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
2
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting "$0
5
6# setup to use ftools
7source $HEADAS/headas-init.sh
8
9logfile=$runlogpath"/FillRatescan-"$datetime".log"
10date >> $logfile
11
12# this script doesn't need variable $doupdate
13# filling is done by macro and update is always done
14
15# get last 3, 6 or 9 nights
16dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
17# `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
18# `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
19 )
20#dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
21
22#dates=( "2013/01/31" )
23
24printprocesslog "INFO processing the following night(s): "${dates[@]}
25echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
26
27#echo ${dates[@]}
28
29cd $mars
30
31# do filling of aux data
32for date in ${dates[@]}
33do
34 auxdir=$auxdata/$date
35 runnumber=`echo $date | sed -e 's/\///g'`
36
37 # check if aux files are available from that night
38 if ! [ -d $auxdir ]
39 then
40 printprocesslog "INFO no data available in "$auxdir
41 continue
42 else
43 printprocesslog "INFO processing files in "$auxdir
44 fi
45
46 ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
47 printprocesslog "INFO processing "$ratescanfile
48 echo "INFO processing "$ratescanfile >> $logfile 2>&1
49 if ! [ -e $ratescanfile ]
50 then
51 rawdir=$rawdata/$date
52 # check if raw files are available from that night
53 if ! [ -d $rawdir ]
54 then
55 printprocesslog "INFO "$ratescanfile" not found."
56 else
57 printprocesslog "WARN "$ratescanfile" not found."
58 fi
59 continue
60 else
61 ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
62 if [ $ratescannumerrors -gt 0 ]
63 then
64 printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
65 fi
66 fi
67
68 printprocesslog "INFO run fillratescan.C for night "$runnumber
69 echo "run fillratescan.C for night "$runnumber >> $logfile 2>&1
70 check1=`root -q -b -l fact/processing/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\) | tee $logfile | intgrep`
71 case $check1 in
72 1) printprocesslog "INFO fillratescan.C was successfully for night "$runumber" (check1=$check1)."
73 ;;
74 0) printprocesslog "WARN connection to DB failed (check1=$check1)."
75 ;;
76 *) printprocesslog "ERROR fillratescan.C failed for night "$runumber" (check1=$check1)."
77 ;;
78 esac
79
80
81done
82
83finish
84
85
Note: See TracBrowser for help on using the repository browser.