#!/bin/bash
# author:佛系城堡孩子王
# desc 检查备份 清理旧备份
result_file=/server/scripts/bak_result.txt
# 1 清理旧备份
find /backup -type f -name "*.tar.gz" -mtime +180 | xargs rm -f
# 2 统计备份结果
find /backup/ -type f -name "*.tar.gz" | xargs \
ls -lhd | \
awk -F'[ /]+' 'BEGIN{print "ip地址","备份文件","文件大小"} {print $(NF-1),$NF,$5}' | \
column -t > ${result_file}
# 2.5 检验md5
echo "以下信息为MD5校验的结果" >> ${result_file}
find /backup/ -name "fingerprint.md5" | xargs md5sum -c >> ${result_file}
# 3 发送邮件
mail -s "每日备份结果" qq@qq.com < ${result_file}
【Shell脚本】rsync服务端-备份数据检查
桃花源小王子2024-08-12 17:06
相关推荐
运维行者_6 小时前
企业无线网络监控的挑战与智能化演进趋势2603_955279707 小时前
Cursor + GitOps:自动化运维新姿势Waay7 小时前
面试口述版:个人对 Prometheus 完整理解三8448 小时前
文件查找/文件压缩/解压缩小猪写代码8 小时前
Linux 管道(Pipeline)作业桌面运维家8 小时前
如何用半缓存云桌面将服务器硬盘容量扩展至本地终端?激情的学姐8 小时前
【大型网站技术实践】初级篇:借助Nginx搭建反向代理服务器ai_coder_ai9 小时前
编写自动化脚本,在自己后端服务中使用Open Api进行设备相关操作会周易的程序员10 小时前
microLog 的本地日志读取接口 log_reader — 本地日志文件读取工具开发指南spider_xcxc10 小时前
Redis 数据库高质量实践指南(一)