Some time due to high load MySQL server gets killed by OS. So we need to make sure that whenever it gets killed restart the mysql server and send an email notification along with status of mysql server. This is simple and yet effective script.
Please see the monitor_mysql.bash script (download link at the end of script)
Customizing the script. Open the script in text editor such as vi, you can customize following 5 directives (read as variable):
Change this if your mysql admin user is not root.
Setup password, this the ONLY one you need to setup.
Setup hostname if it is not localhost
4) MSTART="/etc/init.d/mysql start"
This is default on Debain Linux, you need to setup this according to your UNIX/Linux/BSD OS.
Set Email ID to send notification.
Once all done save the file and install script as cron job. For example run this script every minute
* * * * * /path/to/monitor_mysql.bash
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop