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):
1) MUSER="root"
Change this if your mysql admin user is not root.
2) MPASS="SET-ROOT-PASSWORD"
Setup password, this the ONLY one you need to setup.
3)MHOST="localhost"
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.
5) EMAILID="notification@somewhere-corp.com"
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
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!
