Nginx log slicing script
#! / bin/bashLogs_path='/var/log/nginx' # define the log path yesterday= `date-d "yesterday" +% F` # get yesterday's date cd ${Logs_path} # cut log if [- f access.log]; then cp {, "${date}" _} access.log: > access.log # clear the coquettish operation fiif of source access.log content [- f error.log] Then cp {, "${yesterday}" _} error.log: > error.log # clear the source error.log content of the coquettish operation fifind. -type f-name "* .log"-mtime + 7-delete # delete all logs from 7 days ago