source: branches/trigger_burst_research/Transfer/RsyncRawLP.sh@ 19090

Last change on this file since 19090 was 17594, checked in by Daniela Dorner, 11 years ago
changed logging for connection problems
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2
3# this script has been written to run on La Palma on the machine data
4# i.e. paths are only working on this machine
5
6echo `dirname $0`" is not to be used anymore."
7exit
8
9source `dirname $0`/../Sourcefile.sh
10printprocesslog "INFO starting "$0
11
12logfile=$runlogpath"/RsyncRawLP-"$datetime".log"
13date >> $logfile
14
15# check if /daq is mounted on data
16if ! mount | grep daq >> $logfile 2>&1
17then
18 printprocesslog "ERROR /daq is not mounted on data => please mount it"
19 echo `date`": /daq is not mounted on data => please mount it"
20 finish
21fi
22
23# check if paths are available
24if ! ls /daq/raw >/dev/null 2>&1
25then
26 printprocesslog "ERROR /daq/raw is not available."
27 finish
28fi
29if ! ls /loc_data/raw >/dev/null 2>&1
30then
31 printprocesslog "ERROR /loc_data/raw is not available."
32 finish
33fi
34
35# get last 3, 6 or 9 nights
36#dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
37# `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
38# `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
39# )
40
41dates=(
42 `date +%Y/%m/%d --date="-204hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-156hour"` \
43 `date +%Y/%m/%d --date="-132hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-84hour"` \
44 `date +%Y/%m/%d --date="-60hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-12hour"` \
45 )
46
47# do rsync for rawfiles of these dates
48for date in ${dates[@]}
49do
50 echo "" >> $logfile 2>&1
51 # raw data directories on data
52 rawdirdaq=/daq/raw/$date/ # /loc_data from daq via nfs on data
53 rawdirdata=/loc_data/raw/$date
54 if ! [ -d $rawdirdaq ]
55 then
56 echo `date`": "$rawdirdaq" not found. No data available on daq." >> $logfile 2>&1
57 if [ -d $rawdirdata ]
58 then
59 printprocesslog "WARN "$rawdirdaq" not found, but "$rawdirdata". Data probably taken on data." >> $logfile 2>&1
60 else
61 printprocesslog "INFO "$rawdirdaq" not found. No data available on daq." >> $logfile 2>&1
62 fi
63 continue
64 fi
65 if ! [ -d $rawdirdata ]
66 then
67 mkdir -pv $rawdirdata >> $logfile 2>&1
68 fi
69 printprocesslog "INFO processing files in "$rawdirdaq >> $logfile 2>&1
70 echo `date`": processing files in "$rawdirdaq >> $logfile 2>&1
71
72 # get current hour
73 hour=`date +%k`
74 # define bwlimit for rsync depending on the time: from 19-7h reduced bwlimit for rsync
75 if [ $hour -le 6 ] || [ $hour -ge 19 ]
76 then
77 # limit bw for rsync to 20 MB/s during night
78 bwlimit="--bwlimit=20000"
79 printprocesslog "INFO rsync data with "$bwlimit >> $logfile 2>&1
80 echo "rsync data with "$bwlimit >> $logfile 2>&1
81 else
82 # no bw limit during day
83 bwlimit=""
84 printprocesslog "INFO rsync data without bwlimit" >> $logfile 2>&1
85 echo "rsync data without bwlimit" >> $logfile 2>&1
86 fi
87
88 #rsync from daq to data
89 #if ! /usr/bin/rsync -avxHPu $bwlimit $rawdirdaq $rawdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
90 if ! /usr/bin/rsync -avxHP -T $rsynctempdir $bwlimit $rawdirdaq $rawdirdata >> $logfile 2>&1
91 then
92 printprocesslog "WARN problem rsyncing rawdata for "$date" from daq to data"
93 echo `date`": problem rsyncing rawdata for "$date" from daq to data"
94 fi
95done
96
97finish
98
Note: See TracBrowser for help on using the repository browser.