zjcqoo 6 лет назад
Родитель
Сommit
faa76c0257
4 измененных файлов с 7 добавлено и 11 удалено
  1. 1 3
      log-svc/setup-brotli.sh
  2. 2 1
      log-svc/svc.sh
  3. 3 0
      lua/worker.lua
  4. 1 7
      run.sh

+ 1 - 3
log-svc/setup-brotli.sh

@@ -1,15 +1,13 @@
 #!/usr/bin/env bash
 # 功能:安装 brotli 压缩工具
-# 依赖:cmake(yum install -y cmake)
 
 git clone --depth 1 https://github.com/google/brotli.git
 cd brotli
 
-./configure-cmake
 make
 
 mkdir -p ~/tools
-mv brotli ~/tools
+mv bin/brotli ~/tools
 
 cd ..
 rm -rf brotli

+ 2 - 1
log-svc/svc.sh

@@ -2,10 +2,11 @@
 # 功能:定时调用 backup.sh
 
 echo "log svc running"
+CUR_DIR=$(cd `dirname $0` && pwd)
 
 # 也可用 crontab
 while true
 do
-  ./backup.sh
+  $CUR_DIR/backup.sh
   sleep 60
 done

+ 3 - 0
lua/worker.lua

@@ -16,6 +16,9 @@ local function buildDevTrafficFn(dev)
 
   return function(str)
     local m = ngx.re.match(str, regex, 'oi')
+    if m == nil then
+      return '0,0'
+    end
     local sRxBytes = m[1]
     local sTxBytes = m[2]
 

+ 1 - 7
run.sh

@@ -1,10 +1,4 @@
-NGX_BIN=/home/jsproxy/openresty/nginx/sbin/nginx
-
-# local test
-if [ ! -f $NGX_BIN ]; then
-  NGX_BIN=/usr/local/openresty/nginx/sbin/nginx
-fi
-
+NGX_BIN=$HOME/openresty/nginx/sbin/nginx
 CUR_DIR=$(cd `dirname $0` && pwd)
 
 if [ $1 ]; then