发布于 2017-10-16 12:44:17 | 192 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Linux常用命令,程序狗速度看过来!

Linux

Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。


这篇文章主要介绍了Linux下自动删除归档日志文件的方法,非常不错,具有参考借鉴价值,需要的朋友参考下吧

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" |xargs rm -f
find $backup_path -mtime +7 -name "*.tgz" |xargs rm -f



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务