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

Last change on this file since 17050 was 16992, checked in by Daniela Dorner, 11 years ago
added rsync-temp-dir to avoid temporary files from the rsync on the big storage in Wuerzburg
  • Property svn:executable set to *
File size: 2.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# checking that not more than $numrsyncwuelimit
12# instances of the script are running
13numrsyncwue=`/usr/sbin/lsof $0 | grep -o -c $0`
14if [ $numrsyncwue -gt $numrsyncwuelimit ]
15then
16 printprocesslog "INFO already "$numrsyncwue" BackupRawToWue.sh running -> exit. "
17 finish
18fi
19
20logfile=$runlogpath"/RsyncRawToWue-"$datetime".log"
21date >> $logfile
22
23# get todo list
24gettodo
25
26
27for (( s=0 ; s < $num ; s++ ))
28do
29 night=${primaries[$s+$s]}
30 runid=${primaries[$s+$s+1]}
31 nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
32
33 setstatus "start"
34 if [ $numchanged -eq 0 ]
35 then
36 printprocesslog "INFO "$numchanged" rows were changed in DB => "$night"_"$runid" is already processed => continue."
37 continue
38 fi
39
40 rawdirisdc="/scratch/from_lapalma/raw"
41 rawfileisdc=$rawdirisdc"/./"$nightpath"/"$night"_"`printf %03d $runid`".fits.gz"
42 rawdirwue="/fact/raw/"
43
44 printprocesslog "INFO rsync rawfile "$rawfileisdc" to Wue "$rawdirwue
45 #rsync -rltDvR --partial --stats --password-file=/home_nfs/isdc/fact_opr/rsync.pwd factdata@161.72.93.131::$rawfilelp $rawdirisdc >> $logfile 2>&1
46 rsync -avxR --no-p --stats -T $rsynctempdir $rawfileisdc operator@coma.astro.uni-wuerzburg.de:$rawdirwue >> $logfile 2>&1
47 check1=$?
48
49 case $check1 in
50 0) printprocesslog "INFO rawfile "$rawfileisdc" transferred successfully to Wue."
51 ;;
52 *) printprocesslog "WARN "$rawfileisdc" could not be transferred to Wue."
53 check=$check1
54 ;;
55 esac
56
57 query="SELECT fHasDrsFile from RunInfo WHERE fNight="$night" AND fRunID="$runid
58 numdrs=`sendquery`
59 if [ $numdrs -gt 0 ]
60 then
61 drsfileisdc=$rawdirisdc"/./"$nightpath"/"$night"_"`printf %03d $runid`".drs.fits.gz"
62 printprocesslog "INFO rsync rawfile "$drsfileisdc" to Wue "$rawdirwue
63 rsync -avxR --no-p --stats $drsfileisdc operator@coma.astro.uni-wuerzburg.de:$rawdirwue >> $logfile 2>&1
64 check1=$?
65
66 case $check1 in
67 0) printprocesslog "INFO rawfile "$drsfileisdc" transferred successfully to Wue."
68 ;;
69 *) printprocesslog "WARN "$drsfileisdc" could not be transferred to Wue."
70 check=$check1
71 ;;
72 esac
73 fi
74
75 setstatus "stop"
76done
77
78finish
79
Note: See TracBrowser for help on using the repository browser.