source: trunk/MagicSoft/Mars/datacenter/scripts/cutslices@ 9075

Last change on this file since 9075 was 9046, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.3 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): Stefan Ruegamer 12/2007 <mailto:snruegam@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2007
23#
24#
25# ========================================================================
26#
27# This script is removing the switching noise out of raw files.
28# Corresponding information will be inserted into the database. The noise
29# removal is being done by the script 'compmux'.
30#
31
32source `dirname $0`/sourcefile
33printprocesslog "INFO starting $0"
34echo "This script has not been adapted to the new file structure (MAGIC II). "
35echo "Please adapt it before using it."
36exit
37
38program=compmux
39column=fCompmux
40
41set -C
42
43scriptlog=/magic/datacenter/compmux/$program-$datetime.log
44date >> $scriptlog 2>&1
45todofile=$listpath/ToDo-$table-$column.txt
46
47if [ -e $todofile ]
48then
49 echo "$program is already running -> exit" >> $scriptlog 2>&1
50 exit
51fi
52
53#get todo list
54getdolist >> $scriptlog 2>&1
55
56#retrieving runs from todo file
57files=(`cat $listpath/ToDo-$table-$column.txt`)
58if [ "$files" = "" ]
59then
60 echo "nothing to do -> exit" >> $scriptlog 2>&1
61 finish >> $scriptlog 2>&1
62fi
63
64for file in ${files[@]}
65do
66 echo -e "\ngetting path for run $file..." >> $scriptlog 2>&1
67 fullpath=`find $datapath/rawfiles/2007/0[2-9] -name *${file}_[DCPS]_*`
68
69 lockfile=$lockpath/lock-$program-$file.txt
70
71 #check lock file and stop for this run if already being processed
72 checklock continue >> $scriptlog 2>&1
73
74 primvar=$file
75 setstatus "start" >> $scriptlog 2>&1
76
77 cd $mars
78
79 #cut the slices
80 gzip -cd $fullpath | $mars/datacenter/compmux | gzip -1c > /tmp/temp${file}.gz
81 check1=$?
82 touch -r $fullpath /tmp/temp${file}.gz
83
84 #check success and insert information into the database
85 case $check1 in
86 0) echo " check1=$check1 -> everything ok -> compmux succeeded, overwriting old file for run $file" >> $scriptlog 2>&1
87 mv -f /tmp/temp${file}.gz $fullpath >> $scriptlog 2>&1
88 check2=$?
89 chmod a=r $fullpath
90 case $check2 in
91 0) echo " check2=$check2 -> everything ok -> mv done, setting db status for run $file" >> $scriptlog 2>&1
92 rm -v $lockfile >> $scriptlog 2>&1
93 ;;
94 *) echo " check2=$check2 -> ERROR - moving of run $file failed -> continue" >> $scriptlog 2>&1
95 continue
96 ;;
97 esac
98 ;;
99 *) echo " check1=$check1 -> ERROR - $program failed for run $file" >> $scriptlog 2>&1
100 com=$FCompmux
101 check=$check1
102 ;;
103 esac
104
105 setstatus "stop" >> $scriptlog 2>&1
106done
Note: See TracBrowser for help on using the repository browser.