| 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 | #
|
|---|
| 22 | # Copyright: MAGIC Software Development, 2000-2006
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 | # This script is moving the rawfiles from the directory
|
|---|
| 28 | # /magic/datacenter/fromtape/rawdata to the structure
|
|---|
| 29 | # /magic/data/rawfiles/YYYY/MM/DD
|
|---|
| 30 | #
|
|---|
| 31 |
|
|---|
| 32 | umask 0002
|
|---|
| 33 |
|
|---|
| 34 | # change permission for files
|
|---|
| 35 | ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/*
|
|---|
| 36 | # output for chmod with -v or -c (only changes)
|
|---|
| 37 |
|
|---|
| 38 | #find directories, which have to be copied
|
|---|
| 39 | dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6`
|
|---|
| 40 | # change permission for this dirctories
|
|---|
| 41 | ssh lapalma@mercury chmod -R g+w $dirs
|
|---|
| 42 | # move directories to the tapedirectory
|
|---|
| 43 | mv -v $dirs /magic/datacenter/fromtape/rawdata/
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | # find rawfiles
|
|---|
| 47 | rawfiles=`find /magic/datacenter/fromtape/rawdata/ -name '*.*'`
|
|---|
| 48 | for rawfile in $rawfiles
|
|---|
| 49 | do
|
|---|
| 50 | # workaround for rawfiles with wrong timing
|
|---|
| 51 | # newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles-wrong-timing/g' -e 's/_/\//1' -e 's/_/\//1'`
|
|---|
| 52 | newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
|
|---|
| 53 | newdir=`dirname $newrawfile`
|
|---|
| 54 | if [ ! -d $newdir ]
|
|---|
| 55 | then
|
|---|
| 56 | mkdir -pv $newdir
|
|---|
| 57 | if [ ! -d $newdir ]
|
|---|
| 58 | then
|
|---|
| 59 | echo "could not make dir "$newdir
|
|---|
| 60 | exit
|
|---|
| 61 | fi
|
|---|
| 62 | fi
|
|---|
| 63 |
|
|---|
| 64 | mv -v $rawfile $newrawfile
|
|---|
| 65 | # if gzip -1c $rawfile > $newrawfile.gz
|
|---|
| 66 | # then
|
|---|
| 67 | # rm -v $newrawfile
|
|---|
| 68 | # rm -v $rawfile
|
|---|
| 69 | # fi
|
|---|
| 70 | done
|
|---|
| 71 |
|
|---|
| 72 | rmdir -v /magic/datacenter/fromtape/rawdata/*
|
|---|
| 73 |
|
|---|