lundi 25 avril 2016

Can i write if loop like below?

Condition 1: I want to check if $lavg $lfactor . Condition 2: if above is true then check for $luser 40 or not condition 3:if above is true print some message, else check if $lio 5 incase of true print some message, else print " no IO issue

If all 3 conditions fails , print " no issues found "

Can you please check,below code is correct or not..

if [ "$lavg" -gt $lfactor ]; then
echo -e "\n $highred HIGH LOAD AVG ON $lnode , LOAD AVE IS LAST 5 MINUTES : $lavg $normal"
if [[ $luser -gt 40 ]]; then
echo -e "\n $highred Observed HIGH  %USRER on $lnode , Current %luser : $luser $normal"
echo ""
elif [ $lio -gt 5 ]; then
echo -e "\n $highred Observed HIGH %WAIT  on $lnode , Current %us : $lio $normal"
fi
else
echo  "load avg is within limit"
fi

Thanks.

Aucun commentaire:

Enregistrer un commentaire