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:
To check every x minutes if MySQL server is up and running and if NOT so then restart it automatically.
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