#!/bin/bash

. /etc/rc.d/init.d/functions
. /etc/rc.d/init.d/init_functions
. /etc/profile.d/SetNNEnvVar.sh

# Check that monit and crond have started correctly and that previous indicators have been set
# and then set the LED status.

/sbin/pidof monit
RC1=$?
/sbin/pidof crond
RC2=$?

if [ $RC1 -eq 0 ] && [ $RC2 -eq 0 ];then
    touch /var/run/hc_sanity5
    
    if  [ -f /var/run/hc_sanity1 ]  &&
        [ -f /var/run/hc_sanity2 ]  &&
        [ -f /var/run/hc_sanity3 ]  &&
        [ -f /var/run/hc_sanity4 ]; then
        /nn/bin/AddNnuDiagLog -mStartupSequence -lStartupSequence.log -wR -sI -v10909 "System Startup - startup complete"
    else
        /nn/bin/AddNnuDiagLog -mStartupSequence -lStartupSequence.log -wR -sI -v10938 "hc_sanity5 passed - previous condition failed"
    fi
else
    /nn/bin/AddNnuDiagLog -mStartupSequence -lStartupSequence.log -wR -sI -v10939 "hc_sanity5 failed"
fi

exit 0
