MySQL数据库的可用性监控脚本实例
程序员文章站
2022-03-09 21:57:33
mysql可用性监控脚本
方法一:
[root@host-39-108-217-12 scripts]# cat mysql-available-status.sh
#!/bin/ba...
mysql可用性监控脚本
方法一: [root@host-39-108-217-12 scripts]# cat mysql-available-status.sh #!/bin/bash mysql_ping=`/usr/bin/mysqladmin -uroot -p123456 ping` mysql_ok="mysqld is alive" if [[ "$mysql_ping" != "$mysql_ok" ]];then echo "mysql is not ok !" sleep 5 systemctl restart mariadb else echo "mysql is ok !" fi