source: trunk/DataCheck/Transfer/RsyncAuxLP.sh@ 13106

Last change on this file since 13106 was 13055, checked in by Daniela Dorner, 13 years ago
adapted scripts to changes in directory structure
  • Property svn:executable set to *
File size: 2.6 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"/RsyncAuxLP-"$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/aux >/dev/null 2>&1
22then
23 printprocesslog "ERROR /daq/aux is not available."
24 finish
25fi
26if ! ls /loc_data/aux >/dev/null 2>&1
27then
28 printprocesslog "ERROR /loc_data/aux is not available."
29 finish
30fi
31
32
33# get last 3 nights
34dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` )
35
36# do rsync for rawfiles of these dates
37for date in ${dates[@]}
38do
39 echo "" >> $logfile 2>&1
40 # auxiliary data directories on data
41 auxdirdaq=/daq/aux/$date/ # /loc_data from daq via nfs on data
42 if ! [ -d $auxdirdaq ]
43 then
44 printprocesslog "WARN "$auxdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
45 echo `date`": "$auxdirdaq" not found. Data were probably taken on data" >> $logfile 2>&1
46 continue
47 fi
48 auxdirdata=/loc_data/aux/$date
49 if ! [ -d $auxdirdata ]
50 then
51 mkdir -pv $auxdirdata >> $logfile 2>&1
52 fi
53 printprocesslog "INFO processing files in "$auxdirdaq >> $logfile 2>&1
54 echo `date`": processing files in "$auxdirdaq >> $logfile 2>&1
55
56 # get current hour
57 hour=`date +%k`
58 # define bwlimit for rsync depending on the time: from 19-7h reduced bwlimit for rsync
59 if [ $hour -le 6 ] || [ $hour -ge 19 ]
60 then
61 # limit bw for rsync to 20 MB/s during night
62 bwlimit="--bwlimit=20000"
63 printprocesslog "INFO rsync data with "$bwlimit >> $logfile 2>&1
64 echo "rsync data with "$bwlimit >> $logfile 2>&1
65 else
66 # no bw limit during day
67 printprocesslog "INFO rsync data without bwlimit" >> $logfile 2>&1
68 echo "rsync data without bwlimit" >> $logfile 2>&1
69 fi
70
71 #rsync from daq to data
72 #if ! /usr/bin/rsync -avxHPu $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1 # in case of adding checksum, only update files with rsync
73 if ! /usr/bin/rsync -avxHP $bwlimit $auxdirdaq $auxdirdata >> $logfile 2>&1
74 then
75 printprocesslog "WARN problem rsyncing auxiliary data for "$date" from daq to data"
76 echo `date`": problem rsyncing auxiliary data for "$date" from daq to data"
77 fi
78done
79
Note: See TracBrowser for help on using the repository browser.