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

Last change on this file since 7919 was 7915, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.7 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# get todo file
56possibletodofiles=`ls -r $listpath/ToDo-*-$column-*.txt` >> $scriptlog 2>&1
57if [ "$possibletodofiles" = "" ]
58then
59 echo "ERROR: in $program no todofiles found => something went wrong in jobmanager"
60 finish >> $scriptlog 2>&1
61else
62 singleprocess="yes"
63 echo "todofiles: "${possibletodofiles[@]} >> $scriptlog 2>&1
64 for possibletodofile in ${possibletodofiles[@]}
65 do
66 if ! ls $possibletodofile >> $scriptlog 2>&1
67 then
68 echo "file is not on disk -> continue" >> $scriptlog 2>&1
69 continue
70 fi
71 lockfile=`echo $possibletodofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
72 checklock >> $scriptlog 2>&1
73 todofile=$possibletodofile
74 done
75fi
76if [ "$todofile" = "" ]
77then
78 echo "no todofile found -> exit" >> $scriptlog 2>&1
79 finish >> $scriptlog 2>&1
80fi
81
82# retrieve sequence from todo file
83sequences=(`cat $todofile`)
84if [ "$sequences" = "" ]
85then
86 echo "nothing to do -> exit" >> $scriptlog 2>&1
87 finish >> $scriptlog 2>&1
88fi
89echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
90rm -v $todofile >> $scriptlog 2>&
91
92cd $mars
93
94# run star for sequence
95for sequence in ${sequences[@]}
96do
97 echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
98 no=`printf %08d $sequence | cut -c 0-4`
99 no2=`printf %08d $sequence`
100 var1=$no
101 var2=$no2
102 outpath="$datapath/$program/$no/$no2"
103 inpath=`echo $outpath | sed -e 's/star/callisto/'`
104 makedir $outpath >> $scriptlog 2>&1
105
106 sequfile="$sequpath/$no/sequence$no2.txt"
107
108 setstatus "start" >> $scriptlog 2>&1
109
110 ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile 2>> $scriptlog> /dev/null
111 check1=$?
112
113 case $check1 in
114 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1;;
115 *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
116 com=$Fstar
117 check=$check1
118 ;;
119 esac
120
121 setstatus "stop" >> $scriptlog 2>&1
122done
123
124finish >> $scriptlog 2>&1
125
Note: See TracBrowser for help on using the repository browser.