最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Linux怎么自动删除归档日志文件?Linux自动删除归档日志文件的教程
时间:2022-06-30 16:25:25 编辑:袖梨 来源:一聚教程网
1.日志删除策略
自动删除7天前的归档日志与备份文件。
2.调度计划
0 0 * * * nohup sh /db2backup/script/auto_rm_logs.sh &
3.日志删除脚本
auto_rm_logs.sh
#!/bin/sh
#-------------------------------------
# rm db2 archive log file and *.tgz files @hury
# create @2016-12-13
# script name:auto_rm_logs.sh
# 1.chmod 744 auto_rm_logs.sh
# 2.crontab -e
# for test only
# */2 * * * * nohup sh /db2backup/script/auto_rm_logs.sh &
# for official
# 0 0 * * * nohup sh /db2backup/script/auto_rm_logs.sh &
#------------------------------------
#params
archlog_path=/db2backup/archlog
backup_path=/db2backup/backup
find$archlog_path -mtime +7 -name"S*.LOG"|xargsrm-f
find$backup_path -mtime +7 -name"*.tgz"|xargsrm-f
|
原文链接:http://blog.csdn.net/huryer/article/details/53671904
相关文章
- 《逆水寒手游》群侠逐律流华及绝技百步飞剑抽取建议 08-01
- PLUME可能上涨40%,因为聪明资金正在加速积累 08-01
- 《阴阳锅3阴缘牵》第一章诡媒解谜攻略 08-01
- 《主宰世界》白骨复生活动攻略 08-01
- 《鸣潮》2.2版本新声骸套装流云逝尽之空效果介绍 08-01
- 《原神》5.5版本七圣召唤新增卡牌介绍 08-01