Cron Script to Automatically restart MariaDB on Failure in Bitnami

Published: 18 October 2023
on channel: Hawkdive
112
1

Ubuntu Script to Automatically restart MariaDB service in case of failure. This script is for Bitnami install.

#mariadb #bitnami #vps #hosting #webhosting #webdesigner #ubuntu #debian

To automatically restart MariaDB when it fails in a Bitnami WordPress installation, you can create a simple monitoring script that continuously runs every minute or every 5 minutes to check the MariaDB service status and restart it if it’s found to be crashed, stopped, or failed. Here’s a step-by-step guide:


Create a MariaDB monitoring script: mariadbmon.sh
paste the following

if [[ $(sudo /opt/bitnami/ctlscript.sh status mariadb) == not ]]; then
echo -e "Mariadb Service was down. Restarting now...\n"
sudo /opt/bitnami/ctlscript.sh restart mariadb
else
echo -e "Services are running already. Nothing to do here.\n"
fi


make the script executable
chmod +x mariadbmon.sh


Stop Mariadb
sudo /opt/bitnami/ctlscript.sh stop mariadb

Mariadb Status
sudo /opt/bitnami/ctlscript.sh status mariadb


Set cron to run every minute : open crontan editor using command : crontab -e
paste the following cron. Save the file and exit.
* * * * /bin/bash /home/bitnami/mariadbmon.sh

For detailed information, read our article : https://www.hawkdive.com/how-to-autom...

You may also like to watch:
   • How to take Long Exposure Photo in iP...  
   • How To Take A 48 Mp Photo On Your Iph...  
   • How to Delete All the Script Error Lo...  
   • Add Background Blur Effect to your We...  
   • How to Mirror IOS Device to Windows P...  


Watch video Cron Script to Automatically restart MariaDB on Failure in Bitnami online without registration, duration hours minute second in high quality. This video was added by user Hawkdive 18 October 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 112 once and liked it 1 people.