1、mariadb数据库完整备份
zabbix_mariadb_backup.sh
#!/bin/bash username=root hostname=localhost password=hotdoor@123 File=zabbix_`date ‘+%m-%d-%Y‘`.dump mysql -u$username -h$hostname -p$password -e "show databases" /usr/bin/mysqldump -u$username -h$hostname -p$password --databases zabbix >/data/zabbix-backup/$File if [ $? -eq 0 ];then echo "---------backup OK-------" else echo "-------backup close------" exit fi