I want a bash shell script that i can run using a cron job to check if mysql on a remote server is running. If it is, then do nothing, other start the server.
The cronjob will be checking the remote server for a live (or not) mysql every minute. I can write the cron job myself, but i need help with the shell script that checks if a remote mysql is up or down. The response after a check if up or down is not important. But the check is important.
Thank you.
Best Answer
Connect to
mysqld
using mysqladminMySQL Documentation says about
mysqladmin ping
First, create a user with no privileges
Create a script like this
Place that script in a crontab as you wish
Make sure the firewall is open on 3306 so ping@'%' can connect.