source: tags/Mars-V2.1/datacenter/scripts/cutslices

Last change on this file was 8784, checked in by snruegam, 17 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): 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
33program=compmux
34column=fCompmux
35
36set -C
37
38scriptlog=/magic/datacenter/compmux/$program-$datetime.log
39date >> $scriptlog 2>&1
40todofile=$listpath/ToDo-$table-$column.txt
41
42if [ -e $todofile ]
43then
44 echo "$program is already running -> exit" >> $scriptlog 2>&1
45 exit
46fi
47
48#get todo list
49getdolist >> $scriptlog 2>&1
50
51#retrieving runs from todo file
52files=(`cat $listpath/ToDo-$table-$column.txt`)
53if [ "$files" = "" ]
54then
55 echo "nothing to do -> exit" >> $scriptlog 2>&1
56 finish >> $scriptlog 2>&1
57fi
58
59for file in ${files[@]}
60do
61 echo -e "\ngetting path for run $file..." >> $scriptlog 2>&1
62 fullpath=`find $datapath/rawfiles/2007/0[2-9] -name *${file}_[DCPS]_*`
63
64 lockfile=$lockpath/lock-$program-$file.txt
65
66 #check lock file and stop for this run if already being processed
67 checklock continue >> $scriptlog 2>&1
68
69 primvar=$file
70 setstatus "start" >> $scriptlog 2>&1
71
72 cd $mars
73
74 #cut the slices
75 gzip -cd $fullpath | $mars/datacenter/compmux | gzip -1c > /tmp/temp${file}.gz
76 check1=$?
77 touch -r $fullpath /tmp/temp${file}.gz
78
79 #check success and insert information into the database
80 case $check1 in
81 0) echo " check1=$check1 -> everything ok -> compmux succeeded, overwriting old file for run $file" >> $scriptlog 2>&1
82 mv -f /tmp/temp${file}.gz $fullpath >> $scriptlog 2>&1
83 check2=$?
84 chmod a=r $fullpath
85 case $check2 in
86 0) echo " check2=$check2 -> everything ok -> mv done, setting db status for run $file" >> $scriptlog 2>&1
87 rm -v $lockfile >> $scriptlog 2>&1
88 ;;
89 *) echo " check2=$check2 -> ERROR - moving of run $file failed -> continue" >> $scriptlog 2>&1
90 continue
91 ;;
92 esac
93 ;;
94 *) echo " check1=$check1 -> ERROR - $program failed for run $file" >> $scriptlog 2>&1
95 com=$FCompmux
96 check=$check1
97 ;;
98 esac
99
100 setstatus "stop" >> $scriptlog 2>&1
101done
Note: See TracBrowser for help on using the repository browser.