source: trunk/MagicSoft/Mars/datacenter/scripts/insertsequences@ 7805

Last change on this file since 7805 was 7584, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.8 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 launches the inserting of sequences into the db.
28# It is not used in the automatic processing of data, but only for
29# inserting of manual written sequences.
30#
31# Find manual written sequence files and insert information into the
32# database using the macro insertsequence.C
33#
34
35user=`whoami`
36program=insertsequences
37source /home/$user/Mars/datacenter/scripts/sourcefile
38
39set -C
40
41cd $mars
42
43datetime=`date +%F-%H-%M-%S`
44year=`date +%Y`
45lockfile=$lockpath/lock-insertsequences.txt
46
47scriptlogpath=$logpath/run/insertsequences/`date +%Y/%m`
48makedir $scriptlogpath
49
50scriptlog=$scriptlogpath/insertsequences-$datetime.log
51
52date >> $scriptlog 2>&1
53
54# check if script is already running
55checklock >> $scriptlog 2>&1
56
57# finding manual written sequence files (marked by the comment '#manually changed')
58# for test reasons there has to be cut from 1-47 (not as for operator from 1-42) because of
59# sequpath=/magic/test/sequences (not /magic/sequences)
60sequencefiles=(`grep -R '#manually changed' $sequpath/ | cut -c 1-42`)
61echo "sequencefiles: "${sequencefiles[@]} >> $scriptlog 2>&1
62echo "" >> $scriptlog 2>&1
63
64# process sequencefiles: insert information into the database
65for sequencefile in ${sequencefiles[@]}
66do
67 echo "file: "$sequencefile >> $scriptlog 2>&1
68 no=`echo $sequencefile | cut -c 31-38`
69 insertsequencepath=$logpath/insertsequence/$no
70 makedir $insertsequencepath >> $scriptlog 2>&1
71 insertsequencelog=$insertsequencepath/insertsequence-$no.log
72
73 check0=`root -q -b $macrospath/insertsequence.C+\("\"$sequencefile\""\,kFALSE\) | tee $insertsequencelog | grep int | sed -e 's/(int)//'`
74 case $check0 in
75 1) echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 ;;
76 *) echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
77 esac
78done
79
80rm -v $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1
81
82set +C
83
84date >> $scriptlog 2>&1
85
Note: See TracBrowser for help on using the repository browser.