瀏覽代碼

[CI SKIP]

robert 2 年之前
父節點
當前提交
7062cd7f0b
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      nginxlog_cut.sh

+ 7 - 0
nginxlog_cut.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+log_path=/data/log/resin-books/bo/visit
+DATE=$(date +%Y%m%d%H --date='1 hour ago')
+mv $log_path/access.log $log_path/access.log.$DATE
+kill -USR1 `cat /app/soft/nginx/nginx.pid`
+
+find $log_path -type f -name "access.log.*" -mtime +4|xargs rm -f