#!/bin/bash#切割nginx的日志,然后定期删除source /etc/profilelog_path=/usr/local/nginx/logsd=`date +%Y-%m-%d`d90=`date -d'5 day ago' +%Y-%m-%d` ##5天前cd ${log_path} && cp access.log $log_path/backuplog/accesslog$d.loggzip -f $log_path/backuplog/accesslog$d.logecho > access.logrm -rf $log_path/backuplog/accesslog${d90}.log.gz 编辑crontab
59 23 * * * /bin/sh /data/shell/accesslog.sh