1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | # Author(s): Stefan Ruegamer 02/2007 <mailto:snruegam@astro.uni-wuerzburg.de>
|
---|
22 | #
|
---|
23 | # Copyright: MAGIC Software Development, 2000-2007
|
---|
24 | #
|
---|
25 | #
|
---|
26 | # ========================================================================
|
---|
27 | #
|
---|
28 | # This script is moving the rawfiles from the directory
|
---|
29 | # /magic/datacenter/fromtape/rawdata to the structure
|
---|
30 | # /magic/data/rawfiles/YYYY/MM/DD
|
---|
31 | #
|
---|
32 | # As the data transfer is at the moment not working via .finished files,
|
---|
33 | # you have to use the script movingrawfiles_OK for moving these data
|
---|
34 | #
|
---|
35 |
|
---|
36 | source `dirname $0`/sourcefile
|
---|
37 | printprocesslog "INFO starting $0"
|
---|
38 | program=movingrawfiles2
|
---|
39 |
|
---|
40 | set -C
|
---|
41 | umask 0002
|
---|
42 |
|
---|
43 | scriptlog=$runlogpath/$program-$datetime.log
|
---|
44 | date >> $scriptlog 2>&1
|
---|
45 |
|
---|
46 | # check whether script is already running
|
---|
47 | lockfile=$lockpath/lock-$program.txt
|
---|
48 | checklock >> $scriptlog 2>&1
|
---|
49 |
|
---|
50 | # change permission for files
|
---|
51 | #ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
|
---|
52 | # output for chmod with -v or -c (only changes)
|
---|
53 |
|
---|
54 | # outdated, .finished files are no longer used
|
---|
55 | #printprocesslog "INFO moving directories from fromlapalma to fromtape"
|
---|
56 | # find directories which have to be copied
|
---|
57 | #dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6`
|
---|
58 | #if [ ! "$dirs" == "" ]
|
---|
59 | #then
|
---|
60 | # change permission for this directories
|
---|
61 | #ssh lapalma@dc09 chmod -R g+w $dirs >> $scriptlog 2>&1
|
---|
62 | # move directories to the tapedirectory
|
---|
63 | #mv -v $dirs /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1
|
---|
64 | #fi
|
---|
65 |
|
---|
66 | #printprocesslog "INFO moving directories from muxdata to rawdata"
|
---|
67 | # find directories which have to be copied
|
---|
68 | #days=`find /data/tmp/muxdata/* -type d`
|
---|
69 | #if [ ! "$days" == "" ]
|
---|
70 | #then
|
---|
71 | # move directories to the tapedirectory
|
---|
72 | # mv -v $days /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1
|
---|
73 | #fi
|
---|
74 |
|
---|
75 |
|
---|
76 | # find rawfiles
|
---|
77 | rawfiles=`find /data/fromtape/muxdata/ -name '*.*'`
|
---|
78 |
|
---|
79 | if [ "$rawfiles" == "" ]
|
---|
80 | then
|
---|
81 | echo "no files to move -> exit" >> $scriptlog 2>&1
|
---|
82 | finish >> $scriptlog 2>&1
|
---|
83 | fi
|
---|
84 |
|
---|
85 | printprocesslog "INFO moving rawfiles to $datapath/rawfiles"
|
---|
86 | for rawfile in $rawfiles
|
---|
87 | do
|
---|
88 | # workaround for rawfiles with wrong timing
|
---|
89 | # newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles-wrong-timing/g' -e 's/_/\//1' -e 's/_/\//1'`
|
---|
90 | newrawfile=`echo $rawfile | sed -e 's/\/fromtape\/muxdata//g' -e 's/_/\//1' -e 's/_/\//1'`
|
---|
91 | newdir=`dirname $newrawfile`
|
---|
92 | makedir $newdir >> $scriptlog 2>&1
|
---|
93 |
|
---|
94 | mv -v $rawfile $newrawfile >> $scriptlog 2>&1
|
---|
95 | done
|
---|
96 |
|
---|
97 | rmdir -v /data/fromtape/muxdata/* >> $scriptlog 2>&1
|
---|
98 |
|
---|
99 | printprocesslog "INFO launching filesondisk"
|
---|
100 | echo "launching filesondisk" >> $scriptlog 2>&1
|
---|
101 | $scriptspath/filesondisk&
|
---|
102 |
|
---|
103 | finish >> $scriptlog 2>&1
|
---|
104 |
|
---|