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

Last change on this file since 18290 was 17580, checked in by Daniela Dorner, 11 years ago
implemented fz
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=CheckRawFilesAvail
7step=RawFileAvailISDC
8transferdelay=3 #days
9failsdir=/archive/fact/fails/raw
10
11set -C
12
13# check if script is already running
14lockfile=$lockpath/lock-$program.txt
15checklock
16
17# get todo list
18gettodo
19
20
21for (( s=0 ; s < $num ; s++ ))
22do
23 night=${primaries[$s+$s]}
24 runid=${primaries[$s+$s+1]}
25 currentnight=`date +%Y%m%d`
26 checknight=`echo " $currentnight - $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 ]
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
83 if [ $night -lt $checknight ]
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.