source: trunk/MagicSoft/Mars/datacenter/scripts/runstar@ 7909

Last change on this file since 7909 was 7909, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.5 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 launching star for sequence.
28#
29# In the case of star only one sequence is processed. Despite of
30# that the structure of the script is such, that also more sequences could
31# be processed. The restriction to one sequence has been made, as star
32# takes some time. There's one todo file per sequence.
33# First the script searches for a todo file. Then star is run for the
34# sequence from this todo file.
35#
36# the star.rc files are taken from the mars directory
37#
38
39program=star
40source `dirname $0`/sourcefile
41
42set -C
43
44column=fStar
45#pno=500 # number of processes, i.e. number of todo-files
46
47lockfile=$lockpath/lock-getting-$program-list.txt
48
49scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
50makedir $scriptlogpath
51scriptlog=$scriptlogpath/run$program-$datetime.log
52
53date >> $scriptlog 2>&1
54
55# finding todo file
56echo "checking if other todo-files are there" >> $scriptlog 2>&1
57if ls $todofile-[1-9]*.txt >> $scriptlog 2>&1
58then
59 echo "other file(s) on disk " >> $scriptlog 2>&1
60 echo " -> choose one file and start calculation of image parameter" >> $scriptlog 2>&1
61else
62 # check if getting of list is already running
63 checklock "getting list of" >> $scriptlog 2>&1
64 # get todo list
65 gettodo >> $scriptlog 2>&1
66 rm -v $lockfile >> $scriptlog 2>&1
67fi
68
69# choosing todo file
70nr=bla
71echo "finding the right todo-file" >> $scriptlog 2>&1
72todofiles=`ls -r $listpath/ToDo-$table-$column-*`
73
74for todofile in ${todofiles[@]}
75do
76 if ! ls $todofile >> $scriptlog 2>&1
77 then
78 echo "file is not on disk -> continue" >> $scriptlog 2>&1
79 continue
80 fi
81 lockfile=`echo $todofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
82 date > $lockfile >> $scriptlog 2>&1
83 checklock=$?
84 case $checklock in
85 0) echo "checklock=$checklock -> setting number" >> $scriptlog 2>&1
86 nr=${i}
87 break;;
88 1) echo "checklock=$checklock -> file exists -> continue" >> $scriptlog 2>&1;;
89 *) echo "checklock=$checklock -> something went completely wrong" >> $scriptlog 2>&1;;
90 esac
91done
92
93case $nr in
94 bla) echo "everything is beeing processed -> exit" >> $scriptlog 2>&1
95 date >> $scriptlog 2>&1
96 exit;;
97 12345678) echo "process nr: "$nr >> $scriptlog 2>&1;;
98esac
99
100# retrieve sequence from todo file
101sequences=(`cat $todofile`)
102if [ "$sequences" = "" ]
103then
104 echo "nothing to do -> exit" >> $scriptlog 2>&1
105 finish >> $scriptlog 2>&1
106fi
107
108cd $mars
109
110# run star for sequence
111echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
112for sequence in ${sequences[@]}
113do
114 no=`printf %08d $sequence | cut -c 0-4`
115 no2=`printf %08d $sequence`
116 var1=$no
117 var2=$no2
118 outpath="$datapath/$program/$no/$no2"
119 inpath=`echo $outpath | sed -e 's/star/callisto/'`
120 echo "inpath: "$inpath >> $scriptlog 2>&1
121 echo "outpath: "$outpath >> $scriptlog 2>&1
122 makedir $outpath >> $scriptlog 2>&1
123
124 sequfile="$sequpath/$no/sequence$no2.txt"
125 echo "sequfile: "$sequfile >> $scriptlog 2>&1
126
127 echo "run $program..." >> $scriptlog 2>&1
128 setstatus "start" >> $scriptlog 2>&1
129
130 ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile 2>> $scriptlog> /dev/null
131 check1=$?
132
133 case $check1 in
134 0) echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1;;
135 *) echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
136 com=$Fstar
137 check=$check1
138 ;;
139 esac
140 echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
141 setstatus "stop" >> $scriptlog 2>&1
142done
143
144finish >> $scriptlog 2>&1
145
Note: See TracBrowser for help on using the repository browser.