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-2004
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | #
|
---|
28 |
|
---|
29 | user=`whoami`
|
---|
30 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
---|
31 |
|
---|
32 | set -C
|
---|
33 |
|
---|
34 | cd $mars
|
---|
35 |
|
---|
36 | datetime=`date +%F-%H-%M-%S`
|
---|
37 | year=`date +%Y`
|
---|
38 |
|
---|
39 | scriptlogpath=$logpath/run/insertsequences/`date +%Y/%m`
|
---|
40 | makedir $scriptlogpath
|
---|
41 |
|
---|
42 | scriptlog=$scriptlogpath/insertsequences-$datetime.log
|
---|
43 |
|
---|
44 | date >> $scriptlog 2>&1
|
---|
45 |
|
---|
46 | date > $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1
|
---|
47 | checklock0=$?
|
---|
48 | case $checklock0 in
|
---|
49 | 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
|
---|
50 | 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
|
---|
51 | echo "-> insertsequences is running -> exit" >> $scriptlog 2>&1
|
---|
52 | date >> $scriptlog 2>&1
|
---|
53 | exit;;
|
---|
54 | *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
|
---|
55 | esac
|
---|
56 |
|
---|
57 |
|
---|
58 | sequencefiles=(`grep -R '#manually changed' $sequpath/ | cut -c 1-42`)
|
---|
59 | echo "sequencefiles: "${sequencefiles[@]} >> $scriptlog 2>&1
|
---|
60 | echo "" >> $scriptlog 2>&1
|
---|
61 |
|
---|
62 | for sequencefile in ${sequencefiles[@]}
|
---|
63 | do
|
---|
64 | echo "file: "$sequencefile >> $scriptlog 2>&1
|
---|
65 | no=`echo $sequencefile | cut -c 31-38`
|
---|
66 | insertsequencepath=$logpath/insertsequence/$no
|
---|
67 | makedir $insertsequencepath >> $scriptlog 2>&1
|
---|
68 | insertsequencelog=$insertsequencepath/insertsequence-$no.log
|
---|
69 |
|
---|
70 | check0=`root -q -b $macrospath/insertsequence.C+\("\"$sequencefile\""\,kFALSE\) | tee $insertsequencelog | grep int | sed -e 's/(int)//'`
|
---|
71 | case $check0 in
|
---|
72 | 1) echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 ;;
|
---|
73 | *) echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
|
---|
74 | esac
|
---|
75 | done
|
---|
76 |
|
---|
77 | rm -v $lockpath/lock-insertsequences.txt >> $scriptlog 2>&1
|
---|
78 |
|
---|
79 | set +C
|
---|
80 |
|
---|
81 | date >> $scriptlog 2>&1
|
---|
82 |
|
---|