#!/bin/bash

# Assign class + priority to processes that have not been treated yet
/nn/bin/changeprocesspolicy.sh ksoftirqd_CPU0 IO 50
/nn/bin/changeprocesspolicy.sh Pdrd MGMT 90
/nn/bin/changeprocesspolicy.sh mps CALLP 40
/nn/bin/changeprocesspolicy.sh mgs CALLP 40
/nn/bin/changeprocesspolicy.sh utps CALLP 40
/nn/bin/changeprocesspolicy.sh feps CALLP 40


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

# if  /sbin/pidof monit -eq 0 &&
#     /sbin/pidof crond -eq 0; then
/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
