1. 程式人生 > 其它 >Spring Web MVC 1.3. Annotated Controllers

Spring Web MVC 1.3. Annotated Controllers

## 建立按天日誌切割目錄
mkdir /etc/logrotate.daily.0
## Nginx按天日誌切割配置檔案
cat /etc/logrotate.daily.0/nginx
/applications/nginx/logs/*.log {
        daily   ## 按天切割
        rotate 30   ## 切割檔案保留30天
        missingok  ## 忽略切割過程中的錯誤
        notifempty   ## 日誌為空將不切割壓縮
        #compress   ## gzip方式壓縮
        nodelaycompress  ## 不要將剛切割後的日誌檔案放到下個迴圈中進行壓縮
        dateext  ## 新增切割後的日誌副檔名
        dateformat -%Y-%m-%d  ## 日誌格式
        dateyesterday  ## 日誌命名為昨天的日期
        
        ## 執行postrotate   endscript之間的命令
        postrotate
            if [ -f /applications/nginx/var/nginx.pid ];then
                kill -USR1 cat /applications/nginx/var/nginx.pid
            fi
        endscript
}

## 新增定時任務
crontab -l
#nginx log logrotate
59 23 * * * /usr/sbin/logrotate -f /etc/logrotate.daily.0/nginx >/dev/null 2>&1