source: trunk/DataCheck/Processing/CheckRawFilesAvail.sh@ 19042

Last change on this file since 19042 was 18708, checked in by Daniela Dorner, 8 years ago
avoid warnings for missing files for the first few days; fixed bug in finding start and stop time; improved logging
  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=CheckRawFilesAvail
7step=RawFileAvailISDC
8failsdir=/archive/fact/fails/raw
9
10set -C
11
12# check if script is already running
13lockfile=$lockpath/lock-$program.txt
14checklock
15
16# get todo list
17gettodo
18
19
20for (( s=0 ; s < $num ; s++ ))
21do
22 night=${primaries[$s+$s]}
23 runid=${primaries[$s+$s+1]}
24 # work around for 100 missing old files to avoid warnings every hour
25 currentnight=`date +%Y%m%d`
26 checknight2=`echo " $currentnight - 365 - $transferdelay " | bc -l`
27
28 setstatus "start"
29
30 night2=`echo $night | cut -c 1-4`/`echo $night | cut -c 5-6`/`echo $night | cut -c 7-8`
31 rawfile=$rawdata/$night2/$night"_"`printf %03d $runid`".fits.fz"
32 failsfile=$failsdir/$night2/$night"_"`printf %03d $runid`".fits.fz"
33
34 test -e $rawfile
35 check1=$?
36
37 query="SELECT fHasDrsFile from RunInfo WHERE fNight="$night" AND fRunID="$runid
38 numdrs=`sendquery`
39 if [ $numdrs -gt 0 ]
40 then
41 drsfile=$rawdata/$night2"/"$night"_"`printf %03d $runid`".drs.fits.gz"
42 failsdrsfile=$failsdir/$night2"/"$night"_"`printf %03d $runid`".drs.fits.gz"
43 test -e $drsfile
44 check3=$?
45 fi
46
47 case $check1 in
48 0) printprocesslog "INFO found rawfile "$rawfile
49 if [ $numdrs -gt 0 ]
50 then
51 case $check3 in
52 0) printprocesslog "INFO found drsfile "$drsfile
53 ;;
54 *) test -e $failsdrsfile
55 check4=$?
56 case $check4 in
57 0) printprocesslog "INFO found rawfile in "$failsdrsfile
58 # drs file is not in archive for files which are ok
59 check=$check4
60 ;;
61 *) # print warning only for files which are older than $transferdelay days
62 if [ $night -lt $checknight ] && [ $night -gt $checknight2 ]
63 then
64 printprocesslog "WARN "$drsfile" and "$failsdrsfile" missing."
65 else
66 printprocesslog "INFO "$drsfile" and "$failsdrsfile" missing."
67 fi
68 check="no"
69 ;;
70 esac
71 esac
72 fi
73 ;;
74 *) test -e $failsfile
75 check2=$?
76
77 case $check2 in
78 0) printprocesslog "INFO found rawfile in "$failsfile
79 # raw file is not in archive for files which are ok
80 check=$check2
81 ;;
82 *) # print warning only for files which are older than $transferdelay days and within the last year
83 if [ $night -lt $checknight ] && [ $night -gt $checknight2 ]
84 then
85 printprocesslog "WARN "$rawfile" and "$failsfile" missing."
86 else
87 printprocesslog "INFO "$rawfile" and "$failsfile" missing."
88 fi
89 check="no"
90 ;;
91 esac
92 ;;
93 esac
94
95 setstatus "stop"
96done
97
98finish
99
Note: See TracBrowser for help on using the repository browser.