source: branches/removing_cpp11_features/datacenter/scripts/makecallistolinks@ 18306

Last change on this file since 18306 was 9399, checked in by snruegam, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.1 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-2007
23#
24#
25# ========================================================================
26#
27# This script links a special callisto.rc for data, for which the
28# calibration with the standard callisto.rc failes.
29#
30# The sequences with failing calibration are searched by searching for the
31# reason of failure in the callisto.log Then the special callisto.rc is
32# linked to the directory of the sequence.
33#
34
35source `dirname $0`/sourcefile
36printprocesslog "INFO starting $0"
37program=makecallistolinks
38column=fCallisto
39table=SequenceProcessStatus
40
41set -C
42
43# check if script is already running
44lockfile=$lockpath/lock-$program.txt
45checklock
46
47callistorcseq=callisto.rc
48callistorcnew=callisto_Dec04Jan05.rc
49
50# query failed callistos (returncode 13) from DB
51query="SELECT fSequenceFirst, fTelescopeNumber from SequenceProcessStatus where fReturnCode=13 and fProgramId=14 and fSequenceFirst<200000"
52primaries=( `sendquery` )
53if [ ${#primaries[@]} -eq 0 ]
54then
55 printprocesslog "INFO nothing to do -> exit"
56 finish
57fi
58num=`expr ${#primaries[@]} / 2 `
59
60cd $mars
61
62printprocesslog "INFO linking callisto.rc files"
63for (( s=0 ; s < $num ; s++ ))
64do
65 sequence=${primaries[$s+$s]}
66 telnum=${primaries[$s+$s+1]}
67 callistorc=$datapath/callisto/`printf %08d $sequence | cut -c 0-4`/`printf %08d $sequence`/$callistorcseq
68 if ! ls -l $callistorc 2>/dev/null | grep $callistorcnew >/dev/null
69 then
70 printprocesslog "INFO linking $callistorcnew to $callistorc for sequ $sequence"
71 # resetting the calibration
72 printprocesslog "INFO resetting the callisto for sequence $sequence"
73
74 query="UPDATE SequenceProcessStatus set fStartTime=NULL, fFailedTime=NULL, fProgramId=NULL, fReturnCode=NULL where fSequenceFirst=$sequence and fTelescopeNumber=$telnum"
75 if ! sendquery
76 then
77 printprocesslog "ERROR resetting calibration failed for sequence $sequence"
78 continue
79 else
80 printprocesslog "INFO resetted calibration successfully for sequence $sequence"
81 fi
82
83 #linking callisto.rc
84 if ln -fs $setuppath/callisto/$callistorcnew $callistorc
85 then
86 printprocesslog "INFO link callisto.rc successfully for sequence $sequence"
87 else
88 printprocesslog "ERROR linking callisto.rc failed for sequence $sequence"
89 fi
90
91 fi
92done
93
94finish
95
Note: See TracBrowser for help on using the repository browser.