script to check if the service is running
Hi all,
How to write a script to restart the mysql server when it is down. |
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. |
Thanks Wapcaplet. I now write a script to check if the process ID file isin /var/run.
|
All times are GMT -5. The time now is 09:07 AM. |