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

Last change on this file since 17596 was 17596, checked in by Daniela Dorner, 11 years ago
give warning about missing files only when rawdata 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 rawdir=$rawdata/$date
47 # check if raw files are available from that night
48 if ! [ -d $rawdir ]
49 then
50 logtext="INFO"
51 else
52 logtext="WARN"
53 fi
54
55 ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
56 printprocesslog "INFO processing "$ratescanfile
57 echo "INFO processing "$ratescanfile >> $logfile 2>&1
58 if ! [ -e $ratescanfile ]
59 then
60 printprocesslog $logtext" "$ratescanfile" not found."
61 continue
62 else
63 ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
64 if [ $ratescannumerrors -gt 0 ]
65 then
66 printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
67 fi
68 fi
69
70 printprocesslog "INFO run fillratescan.C for night "$runnumber
71 echo "run fillratescan.C for night "$runnumber >> $logfile 2>&1
72 check1=`root -q -b -l fact/processing/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\) | tee $logfile | intgrep`
73 case $check1 in
74 1) printprocesslog "INFO fillratescan.C was successfully for night "$runumber" (check1=$check1)."
75 ;;
76 0) printprocesslog "WARN connection to DB failed (check1=$check1)."
77 ;;
78 *) printprocesslog "ERROR fillratescan.C failed for night "$runumber" (check1=$check1)."
79 ;;
80 esac
81
82
83done
84
85finish
86
87
Note: See TracBrowser for help on using the repository browser.