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

Last change on this file since 17282 was 17093, checked in by Daniela Dorner, 11 years ago
new macro paths, usage of getdates function, prepared script to be used in RunMoreNights.sh, added error treatment for return value of macro
  • Property svn:executable set to *
File size: 2.5 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 printprocesslog "WARN "$ratescanfile" not found."
52 continue
53 else
54 ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
55 if [ $ratescannumerrors -gt 0 ]
56 then
57 printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
58 fi
59 fi
60
61 printprocesslog "INFO run fillratescan.C for night "$runnumber
62 echo "run fillratescan.C for night "$runnumber >> $logfile 2>&1
63 check1=`root -q -b -l fact/processing/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\) | tee $logfile | intgrep`
64 case $check1 in
65 1) printprocesslog "INFO fillratescan.C was successfully for night "$runumber" (check1=$check1)."
66 ;;
67 0) printprocesslog "WARN connection to DB failed (check1=$check1)."
68 ;;
69 *) printprocesslog "ERROR fillratescan.C failed for night "$runumber" (check1=$check1)."
70 ;;
71 esac
72
73
74done
75
76finish
77
78
Note: See TracBrowser for help on using the repository browser.