1 |
#!/bin/bash |
2 |
|
3 |
export PRODDIR=/gpfs/wizard/flight/production/ |
4 |
|
5 |
export POSTRR=$PRODDIR/postRawreader/ |
6 |
|
7 |
export LOGDIR=$PRODDIR/logs/ |
8 |
|
9 |
export YODA_DATA=$PRODDIR/level0/ |
10 |
|
11 |
export YODA_LOGS=$PRODDIR/level0/ |
12 |
|
13 |
FILE=$1 |
14 |
|
15 |
LOG=$LOGDIR/yoda.`basename $FILE .pam`.log |
16 |
|
17 |
rm -f $LOG; |
18 |
|
19 |
touch $LOG; |
20 |
|
21 |
chmod g+rw $LOG; |
22 |
|
23 |
echo "#####################################" >> $LOG 2>&1; |
24 |
|
25 |
echo " YODA LOG FOR FILE $FILE " >> $LOG 2>&1; |
26 |
|
27 |
echo "#####################################" >> $LOG 2>&1; |
28 |
|
29 |
echo -n " Start date is: " >> $LOG 2>&1; |
30 |
|
31 |
date >> $LOG 2>&1; |
32 |
|
33 |
echo " Job is running on WN: "`hostname` >> $LOG 2>&1; |
34 |
|
35 |
source /gpfs/wizard/flight/production/installed/set_pam_env.sh > /dev/null 2>&1; |
36 |
|
37 |
if [ "$PAM_BIN" == "" ]; then |
38 |
|
39 |
echo "ERROR DURING PAM_ENV SETUP!" >> $LOG 2>&1; |
40 |
|
41 |
exit; |
42 |
|
43 |
fi |
44 |
|
45 |
if [ -f $YODA_DATA/`basename $FILE .pam`.root ]; then |
46 |
|
47 |
R=0; |
48 |
|
49 |
while [ -f $YODA_DATA/`basename $FILE .pam`.root.$R ]; do |
50 |
|
51 |
let R=$R+1; |
52 |
|
53 |
done; |
54 |
|
55 |
OLDFILE=$YODA_DATA/`basename $FILE .pam`.root ; |
56 |
|
57 |
NEWFILE=$YODA_DATA/`basename $FILE .pam`.root.$R ; |
58 |
|
59 |
echo " File $OLDFILE already exists, renamed to $NEWFILE " >> $LOG 2>&1; |
60 |
|
61 |
mv -f $OLDFILE $NEWFILE >> $LOG 2>&1; |
62 |
|
63 |
fi; |
64 |
|
65 |
yoda $FILE >> $LOG 2>&1; |
66 |
|
67 |
if [ -f $YODA_DATA/`basename $FILE .pam`.root ]; then |
68 |
chmod g+rw $YODA_DATA/`basename $FILE .pam`.root >> $LOG 2>&1; |
69 |
fi; |
70 |
if [ -f $YODA_DATA/`basename $FILE .pam`Corrupted.dat ]; then |
71 |
chmod g+rw $YODA_DATA/`basename $FILE .pam`Corrupted.dat >> $LOG 2>&1; |
72 |
fi; |
73 |
|
74 |
echo -n " End date is: " >> $LOG 2>&1; |
75 |
|
76 |
date >> $LOG 2>&1; |
77 |
|
78 |
|
79 |
|