source: trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles@ 7919

Last change on this file since 7919 was 7902, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.7 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#
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
32source `dirname $0`/sourcefile
33
34set -C
35
36program=movingrawfiles
37
38lockfile=$lockpath/lock-$program.txt
39
40scriptlogpath=$logpath/run/$program/`date +%Y`
41makedir $scriptlogpath
42scriptlog=$scriptlogpath/$program-$datetime.log
43
44date >> $scriptlog 2>&1
45
46# check if script is already running
47checklock >> $scriptlog 2>&1
48
49
50umask 0002
51
52# change permission for files
53ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
54# output for chmod with -v or -c (only changes)
55
56#find directories, which have to be copied
57dirs=`ls /magic/datacenter/fromlapalma/RAWchk/*/*.finished | sed -e 's/RAWchk/RAW/g' | cut -d/ -f1-6`
58if [ ! "$dirs" == "" ]
59then
60 # change permission for this dirctories
61 ssh lapalma@apollo 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
64fi
65
66
67# find rawfiles
68rawfiles=`find /magic/datacenter/fromtape/rawdata/ -name '*.*'`
69
70if [ "$rawfiles" == "" ]
71then
72 echo "no files to move -> exit" >> $scriptlog 2>&1
73 finish >> $scriptlog 2>&1
74fi
75
76for rawfile in $rawfiles
77do
78# workaround for rawfiles with wrong timing
79# newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles-wrong-timing/g' -e 's/_/\//1' -e 's/_/\//1'`
80 newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
81 newdir=`dirname $newrawfile`
82 makedir $newdir >> $scriptlog 2>&1
83
84 mv -v $rawfile $newrawfile >> $scriptlog 2>&1
85done
86
87rmdir -v /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
88
89echo "launching filesondisk" >> $scriptlog 2>&1
90$scriptspath/filesondisk&
91
92finish >> $scriptlog 2>&1
93
Note: See TracBrowser for help on using the repository browser.