Link to home
Start Free TrialLog in
Avatar of badwolfff
badwolfffFlag for United Kingdom of Great Britain and Northern Ireland

asked on

On Ubuntu how do I check if my mySQL server is up and running using CRON and restart it if it is not?

Hi all,

I have a ubuntu 14.04 x64 distribution on a Linode VPS with Apache 2.4.7 and mySQL server 5.5.

It doesn't happen everyday but sometimes, when there are a lot of users connected to my server, the mysql server hangs and doesn't restart on its own. I have to manually restart it using putty but since only I have ssh-based admin access, only I can do that. Basically, if MySQL were to hang with me out of office or sleeping, then all my sites would be offline till I got back and rebooted or restarted the MySQL service manually. I would like to use CRON to create a script that could do one of the following things:

1.

To check every x minutes if MySQL server is up and running and if NOT so then restart it automatically.


OR

2.

To restart it everytime it crashes


Could anyone please assist? I have no experience with CRON or .sh scripts and I have only started using linux last month.

thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial