source: trunk/DataCheck/Transfer/RsyncRawToISDC.sh@ 17419

Last change on this file since 17419 was 17149, checked in by Daniela Dorner, 11 years ago
comments what changes needed to use rsync server
  • Property svn:executable set to *
File size: 4.4 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=RsyncRawToISDC
7step=RawFileRsyncedISDC
8pwfile=/home_nfs/isdc/fact_opr/rsync.pwd
9
10set -C
11
12logfile=$runlogpath"/RsyncRawToISDC-"$datetime".log"
13date >> $logfile 2>&1
14
15# check if script is already running
16lockfile=$lockpath/lock-$program.txt
17checklock
18
19# get todo list
20gettodo
21
22for (( s=0 ; s < $num ; s++ ))
23do
24 night=${primaries[$s+$s]}
25 runid=${primaries[$s+$s+1]}
26 nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
27
28 setstatus "start"
29
30 rawfilelp="/loc_data/zipraw/./"$nightpath"/"$night"_"`printf %03d $runid`".fits.gz"
31 rawdirisdc="/scratch/from_lapalma/raw/"
32 rawfileisdc=$rawdirisdc$nightpath"/"$night"_"`printf %03d $runid`".fits.gz"
33 ingestlinkpath="/scratch/ingest_links/raw/"$nightpath
34 makedir $ingestlinkpath >> $logfile 2>&1
35 ingestlink=$ingestlinkpath"/"$night"_"`printf %03d $runid`".fits.gz"
36
37 # for new rsync
38 # remove / from dir
39 # change name of dir (else rsync-server doesn't accept it
40 # test if trick with file/dir is working
41 #echo "INFO rsync rawfile "$rawfilelp" to ISDC "$rawdirisdc
42 printprocesslog "INFO rsync rawfile "$rawfilelp" to ISDC "$rawdirisdc
43 #echo "INFO rsync rawfile "$rawfilelp" to ISDC "$rawdirisdc >> $logfile 2>&1
44 #rsync -rltDvR --partial --stats --password-file=$pwfile factdata@161.72.93.131::$rawfilelp $rawdirisdc >> $logfile 2>&1
45 #echo "rsync -rltDvR -T $rsynctempdir --partial --stats fact@161.72.93.131:$rawfilelp $rawdirisdc >> $logfile 2>&1"
46 rsync -rltDvR -T $rsynctempdir --partial --stats fact@161.72.93.131:$rawfilelp $rawdirisdc >> $logfile 2>&1
47 check1=$?
48
49 case $check1 in
50 0) printprocesslog "INFO rawfile "$rawfilelp" transferred successfully to ISDC."
51 if ! [ -L $ingestlink ]
52 then
53 printprocesslog "INFO create link for "$rawfileisdc
54 ln -sv $rawfileisdc $ingestlink >> $logfile 2>&1
55 check2=$?
56 case $check2 in
57 0) printprocesslog "INFO link for "$rawfileisdc" created successfully."
58 ;;
59 *) printprocesslog "WARN link for "$rawfileisdc" could not be created (check2="$check2")."
60 check=$check2
61 ;;
62 esac
63 else
64 printprocesslog "INFO link "$ingestlink" already existing."
65 fi
66 ;;
67 *) printprocesslog "WARN "$rawfilelp" could not be transferred to ISDC (check1="$check1")."
68 check=$check1
69 ;;
70 esac
71
72 query="SELECT fHasDrsFile from RunInfo WHERE fNight="$night" AND fRunID="$runid
73 numdrs=`sendquery`
74 if [ $numdrs -gt 0 ]
75 then
76 drsfilelp="/loc_data/zipraw/./"$nightpath"/"$night"_"`printf %03d $runid`".drs.fits.gz"
77 drsfileisdc=$rawdirisdc$nightpath"/"$night"_"`printf %03d $runid`".drs.fits.gz"
78 drsingestlink=$ingestlinkpath"/"$night"_"`printf %03d $runid`".drs.fits.gz"
79 printprocesslog "INFO rsync drsfile "$drsfilelp" to ISDC "$rawdirisdc
80 echo "INFO rsync drsfile "$drsfilelp" to ISDC "$rawdirisdc >> $logfile 2>&1
81 #rsync -rltDvR --partial --stats --password-file=$pwfile factdata@161.72.93.131::$rawfilelp $rawdirisdc >> $logfile 2>&1
82 rsync -rltDvR -T $rsynctempdir --partial --stats fact@161.72.93.131:$drsfilelp $rawdirisdc >> $logfile 2>&1
83 check3=$?
84
85 case $check3 in
86 0) printprocesslog "INFO drsfile "$drsfilelp" transferred successfully to ISDC."
87 if ! [ -L $drsingestlink ]
88 then
89 printprocesslog "INFO create link for "$drsfileisdc
90 ln -sv $drsfileisdc $drsingestlink >> $logfile 2>&1
91 check4=$?
92 case $check4 in
93 0) printprocesslog "INFO link for "$drsfileisdc" created successfully."
94 ;;
95 *) printprocesslog "WARN link for "$drsfileisdc" could not be created (check4="$check4")."
96 check=$check4
97 ;;
98 esac
99 else
100 printprocesslog "INFO link "$drsingestlink" already existing."
101 fi
102 ;;
103 *) printprocesslog "WARN "$drsfilelp" could not be transferred to ISDC (check3="$check3")."
104 check=$check3
105 ;;
106 esac
107 fi
108
109 setstatus "stop"
110done
111
112finish
113
Note: See TracBrowser for help on using the repository browser.