source: trunk/Mars/datacenter/scripts/movingrawfiles@ 15487

Last change on this file since 15487 was 9355, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.9 KB
Line 
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-2008
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
36source `dirname $0`/sourcefile
37printprocesslog "INFO starting $0"
38program=movingrawfiles
39
40set -C
41umask 0002
42
43# check whether script is already running
44lockfile=$lockpath/lock-$program.txt
45checklock
46
47# change permission for files
48ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/*
49
50# find rawfiles belonging to tape (don't move files not yet md5-sum checked)
51rawfiles=`find /magic/{datacenter,data/rawfiles}/fromtape/???data/ -regextype posix-egrep -regex '.*/20[01][0-9]{5}_(M[12]_)?[0-9]{8}(\.[0-9]{3})?_.*.raw(.gz)?$' -type f -user tape`
52
53if [ "$rawfiles" == "" ]
54then
55 printprocesslog "INFO no files to move -> exit"
56 finish
57fi
58
59# move rawfiles
60printprocesslog "INFO moving rawfiles to $datapath/rawfiles"
61for rawfile in $rawfiles
62do
63# workaround for rawfiles with wrong timing
64# newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles-wrong-timing/g' -e 's/_/\//1' -e 's/_/\//1'`
65 path=`dirname $rawfile | cut -d/ -f3`
66 if [ "$path" == "datacenter" ]
67 then
68 subpath=`dirname $rawfile | cut -d/ -f5`
69 newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/'${subpath}'/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
70 elif [ "$path" == "data" ]
71 then
72 newrawfile=`echo $rawfile | sed -e 's/\/fromtape\/muxdata//g' -e 's/_/\//1' -e 's/_/\//1'`
73 else
74 printprocesslog "ERROR moving rawfile $rawfile failed"
75 continue
76 fi
77
78 newdir=`dirname $newrawfile`
79 makedir $newdir
80
81 mv -v $rawfile $newrawfile
82done
83
84rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/???data/*
85
86printprocesslog "INFO launching filesondisk"
87$scriptspath/filesondisk &
88
89finish
Note: See TracBrowser for help on using the repository browser.