|
One way is to have your script run "/etc/init.d/mysql status" and look for either "stopped" or "started" in the output (using grep). You may also be able to find out whether it's running by whether or not there's a process ID file in /var/run (should be called /var/run/mysql.pid) - if it's there, it's probably running.
/etc/init.d may or may not exist depending on your distro... sometimes there are different directories for each runlevel, so poke around until you find it.
|