#!/bin/bash find ./ -name "*.log" -size +2048c > ./list ./nginxlog_cut.awk list > ./logtar.sh rm -f ./list sh ./logtar.sh rm -fr ./logtar.sh
nginxlog_cut.awk
#!/usr/bin/awk -f BEGIN{print "#!/bin/bash";print "cd /alidata/log/nginx"} { print "cp -pf "$0" "$0".`date -d "-1 day" +%F`"; print "echo "" > "$0; print "tar -zcvPf "$0".`date -d "-1 day" +%F`.tar.gz "$0".`date -d "-1 day" +%F`"; print "rm -f "$0"`date -d "-1 day" +%F`"; print " " }
©️公众号:思考者文刀
- 上一篇: 加班也得慢半拍
- 下一篇: office365更换不同域下用户的方法
评论