I have written up the following script
#! /bin/bash
function checkIt()
{
ps auxw | grep $1 | grep -v grep > /dev/null
if [ $? != 0 ]
then
echo $1"bad";
else
echo $1"good";
fi;
}
checkIt "nginx";
checkIt "mysql";
checkIt "php5-fpm";
The problem here appears to be with the last check checkIt "php5-fpm"
which consistently returns php5-fpmbad. The trouble appears to arise due to the hyphen. If I do just checkIt "php5"
I get the expected result. I could actually get away with it since I do not have any other process that starts with or contains php5. However, it turns into a hack that will rear up its ugly head one day. I'd be most grateful to anyone who might be able to tell me how to get checkIt "php5-fpm" to work.