#!/bin/sh

#############################################
# que delete script
#############################################
LANG=C;export LANG
SCRIPT_DIR=`dirname $0`
LOG=${SCRIPT_DIR}/log/daedmon_check_`date +%Y%m%d`

## root dir load
. ${SCRIPT_DIR}/.root

ERROR_QUE=${ROOT}/que/error/DAEMON_CHECK_`date +%Y%m%d`
DAEMON_CHECK=`ps -ef | grep ${ROOT}/sbin/ecron_clusterd | grep -v grep`

if [ "${DAEMON_CHECK}" = "" ];then
 echo "`date` daemon don't running !!" >> ${LOG}
 echo "`date` daemon don't running !!" > ${ERROR_QUE}
 ${ROOT}/sbin/ecron_clusterd &
fi

sleep 2

DAEMON_CHECK=`ps -ef | grep ${ROOT}/sbin/ecron_clusterd | grep -v grep` 
if [ "${DAEMON_CHECK}" = "" ];then
 echo "`date` daemon can't start !!" >> ${LOG}
 echo "`date` daemon can't start !!" > ${ERROR_QUE}
fi

exit 0
