Hi LAMP fans
What BASH command(s) can I use to determine whether Apache and the MySQL server are started or not? The reason I ask is because I quickly got fed up typing in commands to start the two servers and wrote the commands into a BASH script, and very handy it is too. So now I have one script for starting these two racehorses and another one for putting them to bed again. However, what I would like to do is this:
#!/bin/bash
# Pseudo-code
if [Apache != "started" && MySQL != "started"]
/usr/local/apache2/bin/apachectl start
/path/to/mysql start etc.
else
shut down the whole lot etc.
So how can I determine whether they are on or off? If you tell me that, I can probably work out the rest myself. Btw - I know you can tell Apache and MySQL to start at boot, but that's not what I want.
If it helps: I'm running Apache 2.x and MySQL 4.1.9.
Thanks
Norm