We apologize that the translated content is not provided to this page.
选择1:sendmail未被封禁情况
yum
安装mutt
和sendmail
包- 配置sh脚本
- 设置
crontab
https://blog.csdn.net/zq199692288/article/details/78929290
选择2:GDrive
yum
安装gdrive
- 运行
gdrive about
获取授权码 - 配置sh脚本,
bakcup.sh
,并修改权限chmod +x backup.sh
- 设置
crontab
backup.sh
:
#!/bin/sh
MYSQL_USER=MSQL备份用户名
MYSQL_PASS=MSQL备份密码
UPLOAD_FOLDER=`gdrive list |grep 你的GDrive根目录下文件夹名 | awk -F' ' '{ print $1 }'` #获取GDrive目录指纹
BACKUP_FOLDER=/tmp
BACKUP=需要备份的目录
D=`date "+%Y-%m-%d_%H:%M:%S"`
mysqldump -uNULL -pNULL --events --all-databases > NULL/backups.sql
zip -9 -r $BACKUP_FOLDER/NULL_backups.zip -P ZIP密码 $BACKUP NULL/backups.sql -x "排除的目录/*" #为了加密选择了zip,不加密可以选择tar保留权限
#上传
gdrive upload --parent $UPLOAD_FOLDER $BACKUP_FOLDER/NULL_backups.zip
#清理备份文件
rm -rf $BACKUP_FOLDER/NULL_backups.zip NULL/backups.sql