| Server IP : 172.64.80.1 / Your IP : 216.73.216.175 Web Server : LiteSpeed System : Linux srv13.swhc.ca 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : hongluck ( 2522) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
# checking logs for last 24 hours only
dd=`date -d'now-24 hours' +%Y-%m-%d" "%H:%m`
# search for ERROR with crashed text and generate the recover command like mysqlcheck -r database_name table_name
awk -vDate="$dd" '{ if ($1 > Date && $4 == "[ERROR]" && $11 == "crashed") { gsub(/\/|\.|\047/," ",$7); print "mysqlcheck -r "$7}}' /var/lib/mysql/mysqlerror.log | sort | uniq | while read command
do
( $command && echo "Fixing MySQL table: $command ... OK" ) || echo "Fixing MySQL table: $command ... STILL CRASHED"
done
echo '' > /var/lib/mysql/mysqlerror.log