diff --git a/app/Makefile b/app/Makefile index c75fdcf..dd9bde5 100755 --- a/app/Makefile +++ b/app/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-unblockmusic PKG_VERSION:=v2.2.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=Apache-2.0 diff --git a/app/luasrc/model/cbi/unblockmusiclog.lua b/app/luasrc/model/cbi/unblockmusiclog.lua index 83d0598..0f0643d 100644 --- a/app/luasrc/model/cbi/unblockmusiclog.lua +++ b/app/luasrc/model/cbi/unblockmusiclog.lua @@ -8,7 +8,7 @@ t = f:field(TextValue, "conf") t.rmempty = true t.rows = 20 function t.cfgvalue() - luci.sys.exec(" sed '/MITM/d' /tmp/unblockmusic.log > /tmp/music.log") + luci.sys.exec("cat /tmp/unblockmusic.log | grep http > /tmp/music.log") return fs.readfile(conffile) or "" end t.readonly="readonly" diff --git a/app/root/etc/init.d/unblockmusic b/app/root/etc/init.d/unblockmusic index dc1b725..7763b6d 100755 --- a/app/root/etc/init.d/unblockmusic +++ b/app/root/etc/init.d/unblockmusic @@ -25,7 +25,7 @@ add_rule() $ipt_n -A cloud_music -d 192.168.0.0/16 -j RETURN $ipt_n -A cloud_music -d 224.0.0.0/4 -j RETURN $ipt_n -A cloud_music -d 240.0.0.0/4 -j RETURN - $ipt_n -A cloud_music -p tcp -j REDIRECT --to-ports 5200 + $ipt_n -A cloud_music -p tcp -j REDIRECT --to-ports 5202 $ipt_n -I PREROUTING -p tcp --dport 80 -m set --match-set music dst -j cloud_music } @@ -83,8 +83,10 @@ start() if [ $TYPE = "default" ]; then node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5200:5201 >/tmp/unblockmusic.log 2>&1 & + node /usr/share/UnblockNeteaseMusic/app.js -p 5202 >>/tmp/unblockmusic.log 2>&1 & else node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5200:5201 -o $TYPE >/tmp/unblockmusic.log 2>&1 & + node /usr/share/UnblockNeteaseMusic/app.js -p 5202 -o $TYPE >>/tmp/unblockmusic.log 2>&1 & fi set_firewall diff --git a/app/root/usr/share/UnblockNeteaseMusic/logcheck.sh b/app/root/usr/share/UnblockNeteaseMusic/logcheck.sh index 4bf2e66..7a423b5 100755 --- a/app/root/usr/share/UnblockNeteaseMusic/logcheck.sh +++ b/app/root/usr/share/UnblockNeteaseMusic/logcheck.sh @@ -1,10 +1,15 @@ #!/bin/bash -log_max_size="4" #使用KB计算 +log_max_size="10" #使用KB计算 log_file="/tmp/unblockmusic.log" while true do + sleep 10s + icount=`busybox ps -w | grep app.js |grep -v grep| wc -l` + if [ $icount -ne 2 ] ;then + /etc/init.d/unblockmusic restart + fi (( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" )) (( "${log_size}" >= "${log_max_size}" )) && echo "" > /tmp/unblockmusic.log sleep 10m