source: trunk/DataCheck/Transfer/BackupRawToWue.sh@ 18322

Last change on this file since 18322 was 18319, checked in by Daniela Dorner, 9 years ago
removed check of certaindate-variable (now done in getdate())
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=RsyncRawToWue
7step=RawFileAvailWue
8
9set -C
10
11# check if only a certain date should be processed
12# (feature for manual speedup)
13if [ "$certaindate" != "" ]
14then
15 printprocesslog "INFO process only data of "$certaindate
16 echo "INFO process only data of "$certaindate
17 specialnight=`echo $certaindate | sed -e 's/\///g'`
18fi
19
20
21# checking that not more than $numrsyncwuelimit
22# instances of the script are running
23numrsyncwue=`/usr/sbin/lsof $0 | grep -o -c $0`
24if [ $numrsyncwue -gt $numrsyncwuelimit ]
25then
26 printprocesslog "INFO already "$numrsyncwue" BackupRawToWue.sh running -> exit. "
27 finish
28fi
29
30logfile=$runlogpath"/RsyncRawToWue-"$datetime".log"
31date >> $logfile
32
33# get todo list
34gettodo
35
36
37for (( s=0 ; s < $num ; s++ ))
38do
39 night=${primaries[$s+$s]}
40 runid=${primaries[$s+$s+1]}
41 nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
42 nightrun=$night"_"`printf %03d $runid`
43
44 if [ "$specialnight" != "" ]
45 then
46 if [ $night -ne $specialnight ]
47 then
48 printprocesslog "INFO Treat only "$specialnight" -> continue for "$night
49 echo "INFO Treat only "$specialnight" -> continue for "$night
50 continue
51 fi
52 fi
53
54 rawdirisdc="/scratch/from_lapalma/raw"
55 isdcfile=`find $rawdirisdc -type f -regex ".*$nightrun[.]fits[.][fg]z"`
56 if [ "$isdcfile" == "" ]
57 then
58 echo "ERROR Could not find raw file for "$nightrun" on isdc-dl00 - Something is really wrong."
59 printprocesslog "ERROR Could not find raw file for "$nightrun" on isdc-dl00 - Something is really wrong."
60 continue
61 else
62 filename=`basename $isdcfile`
63 fi
64
65 rawfileisdc=$rawdirisdc"/./"$nightpath"/"$filename
66 rawdirwue="/fact/raw/"
67
68 setstatus "start"
69 if [ $numchanged -eq 0 ]
70 then
71 printprocesslog "INFO "$numchanged" rows were changed in DB => "$night"_"$runid" is already processed => continue."
72 continue
73 fi
74
75 printprocesslog "INFO rsync rawfile "$rawfileisdc" to Wue "$rawdirwue
76 #rsync -rltDvR --partial --stats --password-file=/home_nfs/isdc/fact_opr/rsync.pwd factdata@161.72.93.131::$rawfilelp $rawdirisdc >> $logfile 2>&1
77 #echo "rsync -avxR --no-p --stats -T $rsynctempdir $rawfileisdc operator@coma.astro.uni-wuerzburg.de:$rawdirwue >> $logfile 2>&1"
78 rsync -avxR --no-p --stats -T $rsynctempdir $rawfileisdc operator@coma.astro.uni-wuerzburg.de:$rawdirwue >> $logfile 2>&1
79 check1=$?
80
81 case $check1 in
82 0) printprocesslog "INFO rawfile "$rawfileisdc" transferred successfully to Wue."
83 ;;
84 *) printprocesslog "CONNECTION "$rawfileisdc" could not be transferred to Wue."
85 check=$check1
86 ;;
87 esac
88
89 query="SELECT fHasDrsFile from RunInfo WHERE fNight="$night" AND fRunID="$runid
90 numdrs=`sendquery`
91 if [ $numdrs -gt 0 ]
92 then
93 drsfileisdc=$rawdirisdc"/./"$nightpath"/"$nightrun".drs.fits.gz"
94 printprocesslog "INFO rsync rawfile "$drsfileisdc" to Wue "$rawdirwue
95 rsync -avxR --no-p --stats $drsfileisdc operator@coma.astro.uni-wuerzburg.de:$rawdirwue >> $logfile 2>&1
96 check1=$?
97
98 case $check1 in
99 0) printprocesslog "INFO rawfile "$drsfileisdc" transferred successfully to Wue."
100 ;;
101 *) printprocesslog "CONNECTION "$drsfileisdc" could not be transferred to Wue."
102 check=$check1
103 ;;
104 esac
105 fi
106
107 setstatus "stop"
108done
109
110finish
111
Note: See TracBrowser for help on using the repository browser.