Have a process that is managed by systemctl start/stop/status but it is at it's core Java. Given the systemctl can capture it's status I plan on using the $? variable to see if the process is up or down.
My script is very simple and works as one might expect on the cli. However I'm missing something in the script in SWs.
/usr/bin/systemctl status PROCESS_NAME >/dev/null
stat=$?
if [ $stat = 0 ];
then
printf "Message:UP\n"
printf "Statistic:$stat\n"
exit 0
else
printf "Message:DOWN\n"
echo "Statistic:$stat"
exit 1
fi

Help is much appreciated.