1 |
#!/bin/bash |
2 |
|
3 |
export PRODDIR=/gpfs/wizard/flight/production/ |
4 |
|
5 |
export RAWDIR=$PRODDIR/preRawreader/ |
6 |
|
7 |
export RRDIR=$PRODDIR/Rawreader/ |
8 |
|
9 |
export CLN1DIR=$PRODDIR/postRawreader/ |
10 |
|
11 |
export LOGDIR=$PRODDIR/logs/ |
12 |
|
13 |
export INFTXT=$LOGDIR/rr/inf_and_txt/ |
14 |
|
15 |
FILE=$1 |
16 |
|
17 |
LOG=$LOGDIR/rr.`basename $FILE .pam`.log |
18 |
|
19 |
rm -f $LOG; |
20 |
|
21 |
touch $LOG; |
22 |
|
23 |
chmod g+rw $LOG; |
24 |
|
25 |
echo "#####################################" >> $LOG 2>&1; |
26 |
|
27 |
echo " RAWREADER LOG FOR FILE $FILE " >> $LOG 2>&1; |
28 |
|
29 |
echo "#####################################" >> $LOG 2>&1; |
30 |
|
31 |
echo -n " Start date is: " >> $LOG 2>&1; |
32 |
|
33 |
date >> $LOG 2>&1; |
34 |
|
35 |
echo " Job is running on WN: "`hostname` >> $LOG 2>&1; |
36 |
|
37 |
source /gpfs/wizard/flight/production/installed/set_pam_env.sh > /dev/null 2>&1; |
38 |
|
39 |
if [ "$PAM_BIN" == "" ]; then |
40 |
|
41 |
echo "ERROR DURING PAM_ENV SETUP!" >> $LOG 2>&1; |
42 |
|
43 |
exit; |
44 |
|
45 |
fi |
46 |
|
47 |
ROUTE=${FILE:0:5} |
48 |
DOWN0=${FILE:5:7} |
49 |
DOWN=`basename $DOWN0 .pam` |
50 |
|
51 |
RawReader.exe $RAWDIR $FILE >> $LOG 2>&1; |
52 |
|
53 |
FOUND=0; |
54 |
|
55 |
for file in `find $RRDIR/$ROUTE/ -name ${ROUTE}_${DOWN}_*_cln1.pam`; do |
56 |
|
57 |
mv -f $file $CLN1DIR >> $LOG 2>&1; |
58 |
|
59 |
chmod g+rw $CLN1DIR/`basename $file` >> $LOG 2>&1; |
60 |
|
61 |
FOUND=1; |
62 |
|
63 |
done |
64 |
|
65 |
mv -f $RRDIR/$ROUTE/`basename $FILE .pam`_cln1.inf $INFTXT >> $LOG 2>&1; |
66 |
|
67 |
chmod g+rw $INFTXT/`basename $FILE .pam`_cln1.inf >> $LOG 2>&1; |
68 |
|
69 |
mv -f $RRDIR/$ROUTE/`basename $FILE .pam`_protocol.txt $INFTXT >> $LOG 2>&1; |
70 |
|
71 |
chmod g+rw $INFTXT/`basename $FILE .pam`_protocol.txt >> $LOG 2>&1; |
72 |
|
73 |
rm -rf $RRDIR/$ROUTE/`basename $FILE .pam`_* >> $LOG 2>&1; |
74 |
|
75 |
rm -rf $RRDIR/$ROUTE/${DOWN}_* >> $LOG 2>&1; |
76 |
|
77 |
TEST=`ls $RRDIR/$ROUTE/`; |
78 |
|
79 |
if [ "$TEST" == "" ]; then |
80 |
|
81 |
rm -rf $RRDIR/$ROUTE/ >> $LOG 2>&1; |
82 |
|
83 |
fi; |
84 |
|
85 |
echo -n " End date is: " >> $LOG 2>&1; |
86 |
|
87 |
date >> $LOG 2>&1; |
88 |
|
89 |
|