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

Last change on this file since 15297 was 13309, checked in by Daniela Dorner, 13 years ago
added check for /archive/fact/fails/raw
  • Property svn:executable set to *
File size: 1.6 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.gz"
32 failsfile=$failsdir/$night2/$night"_"`printf %03d $runid`".fits.gz"
33 test -e $rawfile
34 check1=$?
35
36 case $check1 in
37 0) printprocesslog "INFO found rawfile "$rawfile
38 ;;
39 *) test -e $failsfile
40 check2=$?
41
42 case $check2 in
43 0) printprocesslog "INFO found rawfile in "$failsfile
44 # raw file is not in archive for files which are ok
45 check=$check2
46 ;;
47 *) # print warning only for files which are older than $transferdelay days
48 if [ $night -lt $checknight ]
49 then
50 printprocesslog "WARN "$rawfile" and "$failsfile" missing."
51 else
52 printprocesslog "INFO "$rawfile" and "$failsfile" missing."
53 fi
54 check="no"
55 ;;
56 esac
57 ;;
58 esac
59
60 setstatus "stop"
61done
62
63finish
64
Note: See TracBrowser for help on using the repository browser.