source: trunk/DataCheck/Transfer/RsyncRawLP.sh@ 14098

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