bash script: to check if Apache server is up and running
<p>I am new to bash scripting and trying to figure out why the below script is outputting that <code>Apache server is not running</code> whereas it is running properly. </p>

<pre><code>ps cax | grep httpd
if [ $? -eq 0 ]; then
 echo "Process is running."
else
 echo "Process is not running."
fi
</code></pre>

<p>I'm running it on <code>Ubuntu 14.04.2 LTS</code></p>

<p>Also, how do I make changes to the script that this can test apache server installed on another machine.
Kindly help</p>