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/2006 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2007
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # This a script, which launches other scripts
|
---|
28 | #
|
---|
29 |
|
---|
30 | source `dirname $0`/sourcefile
|
---|
31 | printprocesslog "INFO starting $0 $@"
|
---|
32 |
|
---|
33 | makedir $listpath
|
---|
34 | makedir $lockpath
|
---|
35 |
|
---|
36 | errorlog=$runlogpath/scriptlauncher-error`date +%F`.log
|
---|
37 | scriptlog=$runlogpath/scriptlauncher`date +%F`.log
|
---|
38 |
|
---|
39 | echo `date`": starting $0 $@" >> $scriptlog 2>&1
|
---|
40 |
|
---|
41 | path=`dirname $0`
|
---|
42 | date=`date +%Y-%m-%d`
|
---|
43 |
|
---|
44 | scripts=( `echo $@ | sed -e 's/allatthesametime//'` )
|
---|
45 | num=${#scripts[@]}
|
---|
46 | echo "$num scripts have to be launched" >> $scriptlog 2>&1
|
---|
47 | i=0
|
---|
48 |
|
---|
49 | while [ $i -lt $num ]
|
---|
50 | do
|
---|
51 | echo " launching ${scripts[$i]}..." >> $scriptlog 2>&1
|
---|
52 | pid=`/usr/local/bin/condor_submit -a path=$path -a prog=${scripts[$i]} -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2`
|
---|
53 | if [ "$pid" = "" ]
|
---|
54 | then
|
---|
55 | echo `date`" WARN condor is not working " >> $errorlog 2>&1
|
---|
56 | printprocesslog "WARN submitting ${scripts[$i]} to condor failed"
|
---|
57 | continue
|
---|
58 | fi
|
---|
59 | if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog
|
---|
60 | then
|
---|
61 | echo " waiting for ${scripts[$i]} to be done..." >> $scriptlog 2>&1
|
---|
62 | /usr/local/bin/condor_wait $runlogpath/condor-$date.log $pid >/dev/null 2>$errorlog
|
---|
63 | fi
|
---|
64 | i=`expr $i + 1`
|
---|
65 | done
|
---|
66 | echo `date`": all done/submitted." >> $scriptlog 2>&1
|
---|
67 | echo "" >> $scriptlog 2>&1
|
---|
68 |
|
---|
69 | printprocesslog "INFO finished $0 $@"
|
---|
70 |
|
---|