inio需要备份, 只设置备份文件夹备份, 因为minio有挂载文件,所以只要把挂载文件夹备份就好了;
备份脚本如下:
LOG_FILE="/data/backup/minio/logfile.log"
write_log() {
local message=$1
echo "$(date +"%Y-%m-%d %H:%M:%S") - $message" >> "$LOG_FILE"
}
write_log "开始备份"
cd /home/data/minio/data
tar -zcvf tly$(date -d "today" +"%Y%m%d").tar.gz tly
mv tly$(date -d "today" +"%Y%m%d").tar.gz /data/backup/minio/tly
# linux删除2个月前的文件命令
DIRECTORY="/data/backup/minio/tly"
write_log "备份完成"
find "$DIRECTORY" -type f -mtime +60 -delete
write_log "删除两个月前备份"
DELETED_FILES_COUNT=$(find "$DIRECTORY" -type f -mtime +60 -delete)
write_log "已删除 $DELETED_FILES_COUNT 个文件"
write_log "脚本执行完毕"
使用crontab 设置定时任务 每月备份两次
crontab -e
0 0 1,15 * * /data/backup/minio/minio_backup.sh
标签:log,lunix,备份,write,文件夹,data,tly,minio
From: https://blog.51cto.com/u_15266301/8727135