| 31 |
|
|
| 32 |
rm -f $logPfix.*.log_bak |
rm -f $logPfix.*.log_bak |
| 33 |
if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi |
if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi |
| 34 |
echo -n '-- Starting: ' | tee -a $LOG_FIL |
echo -n '-- Starting: ' | tee -a $LOG_FIL |
| 35 |
date | tee -a $LOG_FIL |
date | tee -a $LOG_FIL |
| 36 |
|
|
| 37 |
n=$(( `ls $logPfix.*.log | wc -l` - 10 )) |
n=$(( `ls $logPfix.*.log | wc -l` - 10 )) |
| 38 |
if test $n -gt 0 ; then |
if test $n -gt 0 ; then |
| 39 |
echo ' remove old log files:' | tee -a $LOG_FIL |
echo ' remove old log files:' | tee -a $LOG_FIL |
| 40 |
ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL |
ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL |
| 41 |
ls -t $logPfix.*.log | tail -"$n" | xargs rm -f |
ls -t $logPfix.*.log | tail -"$n" | xargs rm -f |
| 42 |
fi |
fi |
| 43 |
|
|
| 44 |
. /etc/profile.d/modules.sh |
if test -f /etc/profile.d/modules.sh ; then |
| 45 |
module list >> $LOG_FIL 2>&1 |
. /etc/profile.d/modules.sh |
| 46 |
|
fi |
| 47 |
|
module list >> $LOG_FIL 2>&1 |
| 48 |
|
|
| 49 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 50 |
#-- now really do something: |
#-- now really do something: |
| 66 |
#-- move previous output file |
#-- move previous output file |
| 67 |
outList=`ls $JOB.std??? 2> /dev/null` |
outList=`ls $JOB.std??? 2> /dev/null` |
| 68 |
if test "x$outList" != x ; then |
if test "x$outList" != x ; then |
| 69 |
echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL |
echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL |
| 70 |
if test -d $OUT_DIR/prev ; then |
if test -d $OUT_DIR/prev ; then |
| 71 |
for xx in $outList ; do |
for xx in $outList ; do |
| 72 |
echo -n " $xx" | tee -a $LOG_FIL |
pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL |
| 73 |
mv -f $xx $OUT_DIR/prev |
test -f $pp.sav && mv -f $pp.sav $pp.old |
| 74 |
|
test -f $pp && mv -f $pp $pp.sav |
| 75 |
|
chmod a+r $xx ; mv -f $xx $OUT_DIR/prev |
| 76 |
done |
done |
| 77 |
echo " to dir ./prev" | tee -a $LOG_FIL |
echo " to dir ./prev" | tee -a $LOG_FIL |
| 78 |
else |
else |
| 79 |
echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL |
echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL |
| 80 |
fi |
fi |
| 81 |
else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL |
else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL |
| 82 |
fi |
fi |
| 83 |
#-- submit job |
#-- submit job |
| 84 |
echo -n "--> $JOB : " | tee -a $LOG_FIL |
echo -n "--> $JOB : " | tee -a $LOG_FIL |
| 85 |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
| 86 |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
| 87 |
else |
else |
| 88 |
echo "--> $JOB :" | tee -a $LOG_FIL |
echo "--> $JOB :" | tee -a $LOG_FIL |
| 89 |
$QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL |
$QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL |
| 90 |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
| 91 |
fi |
fi |
| 92 |
else |
else |
| 93 |
echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL |
echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL |
| 94 |
fi |
fi |
| 95 |
done |
done |
| 96 |
echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL |
echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL |
| 97 |
|
echo -n '-- Finished at: ' | tee -a $LOG_FIL |
| 98 |
|
date | tee -a $LOG_FIL |
| 99 |
|
|
| 100 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 101 |
exit 0 |
exit 0 |