Shell cutting log script
Vi / etc/logrotate.d/nginx # Editing script
/ usr/local/nginx/logs/*.log / usr/local/nginx/logs/nginx_logs/*.log {
Missingok # ignores errors, such as the "log file cannot be found" error message.
Dateext # switched log files will be appended with a dash and a date in YYYYMMDD format. Without this configuration item, a decimal point and a numeric sequence number will be appended.
Notifempty # if the log file is empty, no cutting is performed.
Daily # cut logs on a daily basis. Available value month: monthly week: weekly year: yearly
Rotate 3 # keeps log records for the last 3 days
Sharedscripts # scripts that run only once for the entire log group
The commands specified in postrotate # will be executed
If [- f / usr/local/nginx/logs/nginx.pid]; then
Kill-USR1 `cat / usr/local/nginx/logs/ nginx.pid`
Fi
Endscript
}