#!/bin/bash

# Run MariaDB status command
/etc/init.d/mariadb status

# Check the exit code
if [ $? -ne 0 ]; then
# Restart MariaDB server
/etc/init.d/mariadb restart

# Send an email notification
echo "MariaDB server restarted due to an issue. Please check." | mail -s "MariaDB Server Restarted" your_email@example.com
fi



######
# crontab
#####
0 * * * * /path/to/mariadb_monitor.sh >/dev/null 2>&1

computer2know :: thank you for your visit :: have a nice day :: © 2024