Dear,
Required an script such that :
If metastat |grep Needs , results in some output then this command to be executed for the same :
opcmsg object=metastat a=OS msg_grp=OpC severity=critical msg_text="Need maintenance for the system $line"
With regards,
Mjoshi
if the grep command gives some output, then opcmsg command will execute
metastat | grep Needs > /dev/null
if [ "$?" -eq "0" ]
then
opcmsg object=metastat a=OS msg_grp=OpC severity=critical msg_text="Need maintenance for the system $line"
fi
$? - holding the previous command exit status
echo "abc" | grep abc
echo $?
echo "xyz" | grep abc
echo $?
if the value of $? is zero, then the previous command is success