标签:
#!/bin/bash cutfile1="access_log" cutfile2="error_log" #keepdays=31 cd /etc/httpd/logs/ tar zcvf ${cutfile1}_$(date +"%Y%m%d" --date="-1 day").tar.gz ${cutfile1} tar zcvf ${cutfile2}_$(date +"%Y%m%d" --date="-1 day").tar.gz ${cutfile2} echo "">${cutfile1} echo "">${cutfile2} #rm -f ${cutfile1}_$(date +"%Y%m%d" --date="-${keepdays} day") #rm -f ${cutfile2}_$(date +"%Y%m%d" --date="-${keepdays} day")
放在crotab 中执行。
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/naola2001/article/details/48047973