source: trunk/DataCheck/Processing/CheckAuxFilesAvail.sh@ 14835

Last change on this file since 14835 was 14827, checked in by Daniela Dorner, 12 years ago
small change for date calculation
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=CheckAuxFilesAvail
7step=AuxFilesAvailISDC
8transferdelay=3 #days
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]}
23 currentnight=`date +%Y%m%d`
24 #checknight=`echo " $currentnight - $transferdelay " | bc -l`
25 checknight=`date +%Y%m%d --date="-${transferdelay}day"`
26
27 setstatus "start"
28
29 auxpath=$auxdata"/"`echo $night | cut -c 1-4`/`echo $night | cut -c 5-6`/`echo $night | cut -c 7-8`
30 drivefile=$auxpath/$night".DRIVE_CONTROL_TRACKING_POSITION.fits"
31 weatherfile=$auxpath/$night".MAGIC_WEATHER_DATA.fits"
32 ratesfile=$auxpath/$night".FTM_CONTROL_TRIGGER_RATES.fits"
33 temperaturefile=$auxpath/$night".FSC_CONTROL_TEMPERATURE.fits"
34 humidityfile=$auxpath/$night".FSC_CONTROL_HUMIDITY.fits"
35
36 test -e $drivefile
37 check1=$?
38 test -e $weatherfile
39 check2=$?
40 test -e $ratesfile
41 check3=$?
42 test -e $temperaturefile
43 check4=$?
44 test -e $humidityfile
45 check5=$?
46
47 totalcheck=`echo $check1 + $check2 + $check3 + $check4 + $check5 | bc -l`
48 totalcheck2=${check1}${check2}${check3}${check4}${check5}
49
50 case $totalcheck in
51 0) printprocesslog "INFO found auxfiles for night "$night"."
52 ;;
53 *) if [ $night -lt $checknight ]
54 then
55 printprocesslog "WARN "$totalcheck" auxiliary files missing ("$totalcheck2") for night "$night"."
56 check=$totalcheck2
57 else
58 check="no"
59 printprocesslog "INFO "$totalcheck" auxiliary files missing ("$totalcheck2") for night "$night"."
60 fi
61 ;;
62 esac
63
64 setstatus "stop"
65done
66
67finish
68
Note: See TracBrowser for help on using the repository browser.