1 | #!/bin/sh
|
---|
2 | #
|
---|
3 |
|
---|
4 | source `dirname $0`/../Sourcefile.sh
|
---|
5 | printprocesslog "INFO starting $0"
|
---|
6 | program=RsyncRawToISDC
|
---|
7 | step=RawFileRsyncedISDC
|
---|
8 | pwfile=/home_nfs/isdc/fact_opr/rsync.pwd
|
---|
9 |
|
---|
10 | set -C
|
---|
11 |
|
---|
12 | logfile=$runlogpath"/RsyncRawToISDC-"$datetime".log"
|
---|
13 | date >> $logfile 2>&1
|
---|
14 |
|
---|
15 | # check if script is already running
|
---|
16 | lockfile=$lockpath/lock-$program.txt
|
---|
17 | checklock
|
---|
18 |
|
---|
19 | # get todo list
|
---|
20 | gettodo
|
---|
21 |
|
---|
22 |
|
---|
23 | for (( s=0 ; s < $num ; s++ ))
|
---|
24 | do
|
---|
25 | night=${primaries[$s+$s]}
|
---|
26 | runid=${primaries[$s+$s+1]}
|
---|
27 | nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
|
---|
28 |
|
---|
29 | setstatus "start"
|
---|
30 |
|
---|
31 | rawfilelp="/loc_data/zipraw/./"$nightpath"/"$night"_"`printf %03d $runid`".fits.gz"
|
---|
32 | rawdirisdc="/scratch/from_lapalma/raw/"
|
---|
33 | rawfileisdc=$rawdirisdc$nightpath"/"$night"_"`printf %03d $runid`".fits.gz"
|
---|
34 | ingestlinkpath="/scratch/ingest_links/raw/"$nightpath
|
---|
35 | makedir $ingestlinkpath >> $logfile 2>&1
|
---|
36 | ingestlink=$ingestlinkpath"/"$night"_"`printf %03d $runid`".fits.gz"
|
---|
37 |
|
---|
38 | printprocesslog "INFO rsync rawfile "$rawfilelp" to ISDC "$rawdirisdc
|
---|
39 | echo "INFO rsync rawfile "$rawfilelp" to ISDC "$rawdirisdc >> $logfile 2>&1
|
---|
40 | #rsync -rltDvR --partial --stats --password-file=$pwfile factdata@161.72.93.131::$rawfilelp $rawdirisdc >> $logfile 2>&1
|
---|
41 | rsync -rltDvR --partial --stats fact@161.72.93.131:$rawfilelp $rawdirisdc >> $logfile 2>&1
|
---|
42 | check1=$?
|
---|
43 |
|
---|
44 | case $check1 in
|
---|
45 | 0) printprocesslog "INFO rawfile "$rawfilelp" transferred successfully to ISDC."
|
---|
46 | printprocesslog "INFO create link for "$rawfileisdc
|
---|
47 | ln -sv $rawfileisdc $ingestlink >> $logfile 2>&1
|
---|
48 | check2=$?
|
---|
49 | case $check2 in
|
---|
50 | 0) printprocesslog "INFO link for "$rawfileisdc" created successfully."
|
---|
51 | ;;
|
---|
52 | *) printprocesslog "WARN link for "$rawfileisdc" could not be created."
|
---|
53 | check=$check2
|
---|
54 | ;;
|
---|
55 | esac
|
---|
56 | ;;
|
---|
57 | *) printprocesslog "WARN "$rawfilelp" could not be transferred to ISDC."
|
---|
58 | check=$check1
|
---|
59 | ;;
|
---|
60 | esac
|
---|
61 |
|
---|
62 |
|
---|
63 | setstatus "stop"
|
---|
64 | done
|
---|
65 |
|
---|
66 | finish
|
---|
67 |
|
---|