Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash
#######     ------    beginning   --------  #######################
BASEDIR=@root
LOGFILE=${BASEDIR}/logs/TimeBasedO2O.log
DATE=`date`
echo " " | tee -a $LOGFILE
echo "----- new cronjob started for Time Based O2O at -----" | tee -a $LOGFILE
echo "$DATE" | tee -a $LOGFILE

#Check if the exportation script is running, if so exits without launching it
PID_0=`ps aux | grep '/bin/sh @root/scripts/EcalLaser.sh' | grep -v grep | awk '{print $2}'`
if [ "${PID_0}" ]
    then
    echo "Ecal Laser Exportation script still running with pid ${PID_0}: exiting" | tee -a $LOGFILE
    exit 1
else
    /bin/sh @root/scripts/EcalLaser.sh
fi
PID_1=`ps aux | grep '/bin/sh @root/scripts/EcalLaser_express.sh' | grep -v grep | awk '{print $2}'`
if [ "${PID_1}" ]
    then
    echo "Ecal LaserExpress Exportation script still running with pid ${PID_1}: exiting" | tee -a $LOGFILE
    exit 1
else
    /bin/sh @root/scripts/EcalLaser_express.sh
fi