From 860cff142683b0dbc89333fc33d4440364285baa Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Sat, 23 Mar 2024 04:15:49 +0800 Subject: [PATCH] update 2024-03-23 04:15:49 --- luci-app-alist/root/etc/init.d/alist | 8 +- luci-app-autotimeset/Makefile | 2 +- .../luasrc/model/cbi/autotimeset/base.lua | 10 +- .../root/etc/config/autotimeset | 3 +- .../root/etc/init.d/autotimeset | 10 +- luci-app-netspeedtest/Makefile | 7 +- .../luasrc/controller/netspeedtest.lua | 61 ++++++++---- .../luasrc/model/cbi/netspeedtest/log.lua | 13 +++ .../model/cbi/netspeedtest/speedtestport.lua | 3 - .../model/cbi/netspeedtest/speedtestwan.lua | 8 +- .../luasrc/view/netspeedtest/log.htm | 61 +++++++++--- .../luasrc/view/netspeedtest/speedtestwan.htm | 97 +++++++++++-------- .../root/etc/init.d/netspeedtest | 58 ++++++----- .../etc/uci-defaults/40_luci-netspeedtest | 9 ++ 14 files changed, 226 insertions(+), 124 deletions(-) create mode 100644 luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/log.lua diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist index 23ceeee57..ed0eab238 100755 --- a/luci-app-alist/root/etc/init.d/alist +++ b/luci-app-alist/root/etc/init.d/alist @@ -103,7 +103,7 @@ start_service() { "force_https": false, "cert_file": "$ssl_cert", "key_file": "$ssl_key", - "unix_file": "/var/alist.sock" + "unix_file": "/var/run/alist.sock" }, "temp_dir": "$temp_dir", "bleve_dir": "$data_dir/bleve", @@ -121,13 +121,15 @@ start_service() { } EOF - procd_open_instance alist + procd_open_instance procd_set_param command $PROG procd_append_param command server --data $data_dir procd_set_param stdout 0 procd_set_param stderr 0 procd_set_param respawn - procd_close_instance alist + procd_set_param limits core="unlimited" + procd_set_param limits nofile="200000 200000" + procd_close_instance } service_triggers() { diff --git a/luci-app-autotimeset/Makefile b/luci-app-autotimeset/Makefile index d48081075..d30618957 100644 --- a/luci-app-autotimeset/Makefile +++ b/luci-app-autotimeset/Makefile @@ -12,7 +12,7 @@ LUCI_TITLE:=LuCI support for Scheduled Time setting LUCI_PKGARCH:=all PKG_VERSION:=2.1.0 -PKG_RELEASE:=20240311 +PKG_RELEASE:=20240318 define Package/$(PKG_NAME)/conffiles diff --git a/luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua b/luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua index babb72edf..14fc33dd3 100644 --- a/luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua +++ b/luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua @@ -13,12 +13,12 @@ s.anonymous=true e=s:option(TextValue, "customscript" ,translate("Edit Custom Script")) e.description = translate("The execution content of the [Scheduled Customscript] in the task name") e.rows = 5 -e.rmempty = false +e.default=" " e=s:option(TextValue, "customscript2" ,translate("Edit Custom Script2")) e.description = translate("The execution content of the [Scheduled Customscript2] in the task name") e.rows = 5 -e.rmempty = false +e.default=" " s=m:section(TypedSection,"stime","") s.addremove=true @@ -38,9 +38,9 @@ e:value(9,translate("Scheduled DisReconn")) e:value(10,translate("Scheduled DisRereboot")) e:value(11,translate("Scheduled Restartmwan3")) e:value(12,translate("Scheduled Customscript")) -e:value(13,translate("Scheduled Customscript2")) -e:value(14,translate("Scheduled Wifiup")) -e:value(15,translate("Scheduled Wifidown")) +e:value(13,translate("Scheduled Wifiup")) +e:value(14,translate("Scheduled Wifidown")) +e:value(15,translate("Scheduled Customscript2")) e.default=2 e=s:option(Flag,"enable",translate("Enable")) diff --git a/luci-app-autotimeset/root/etc/config/autotimeset b/luci-app-autotimeset/root/etc/config/autotimeset index 27631e564..ef5141baa 100644 --- a/luci-app-autotimeset/root/etc/config/autotimeset +++ b/luci-app-autotimeset/root/etc/config/autotimeset @@ -1,6 +1,7 @@ config global option enabled '0' - option customscript '#!/bin/sh' + option customscript '# Sh script rules' + option customscript2 '# Sh script rules' config stime option hour '*/4' diff --git a/luci-app-autotimeset/root/etc/init.d/autotimeset b/luci-app-autotimeset/root/etc/init.d/autotimeset index 5250bf883..4af3b916a 100644 --- a/luci-app-autotimeset/root/etc/init.d/autotimeset +++ b/luci-app-autotimeset/root/etc/init.d/autotimeset @@ -77,17 +77,17 @@ do [ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler customscript Startup_task" >>$TT ;; 13) - local cmd="$minute $hour * $month $week /usr/bin/timesethandler customscript2 Scheduled_task" - [ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler customscript2 Startup_task" >>$TT - ;; - 14) local cmd="$minute $hour * $month $week /usr/bin/timesethandler upwifi Scheduled_task" [ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler upwifi Startup_task" >>$TT ;; - 15) + 14) local cmd="$minute $hour * $month $week /usr/bin/timesethandler downwifi Scheduled_task" [ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler downwifi Startup_task" >>$TT ;; + 15) + local cmd="$minute $hour * $month $week /usr/bin/timesethandler customscript2 Scheduled_task" + [ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler customscript2 Startup_task" >>$TT + ;; esac fi done diff --git a/luci-app-netspeedtest/Makefile b/luci-app-netspeedtest/Makefile index 844a5a4b6..e7181aef6 100644 --- a/luci-app-netspeedtest/Makefile +++ b/luci-app-netspeedtest/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-netspeedtest -PKG_VERSION:=2.2.3 -PKG_RELEASE:=20240315 +PKG_VERSION:=2.2.4 +PKG_RELEASE:=20240319 LUCI_TITLE:=LuCI Support for netspeedtest LUCI_DEPENDS:=+python3 +iperf3-ssl +homebox @@ -24,8 +24,7 @@ endef define Package/$(PKG_NAME)/postinst endef -define Package/$(PKG_NAME)/prerm -endef + include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-netspeedtest/luasrc/controller/netspeedtest.lua b/luci-app-netspeedtest/luasrc/controller/netspeedtest.lua index 9768b8bff..d595ec195 100644 --- a/luci-app-netspeedtest/luasrc/controller/netspeedtest.lua +++ b/luci-app-netspeedtest/luasrc/controller/netspeedtest.lua @@ -1,6 +1,7 @@ -- Copyright (C) 2020-2022 sirpdboy https://github.com/sirpdboy/netspeedtest module("luci.controller.netspeedtest", package.seeall) +local http = require "luci.http" local fs=require"nixio.fs" local sys=require "luci.sys" local uci = luci.model.uci.cursor() @@ -8,22 +9,47 @@ name='netspeedtest' function index() if not nixio.fs.access("/etc/config/netspeedtest") then return end - local e = entry({"admin","network","netspeedtest"},alias("admin", "network", "netspeedtest", "speedtestlan"),_("Net Speedtest"), 90) - e.dependent=false - e.acl_depends = { "luci-app-netspeedtest" } + + local e = entry({"admin","network","netspeedtest"},alias("admin", "network", "netspeedtest", "speedtestlan"),_("Net Speedtest"),90) + e.dependent = false + e.acl_depends = { "luci-app-netspeedtest" } + entry({"admin", "network", "netspeedtest", "speedtestlan"},cbi("netspeedtest/speedtestlan"),_("Lan Speedtest Web"),20).leaf = true entry({"admin", "network", "netspeedtest", "speedtestiperf3"},cbi("netspeedtest/speedtestiperf3", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Lan Speedtest Iperf3"),30).leaf = true entry({"admin", "network", "netspeedtest", "speedtestwan"},cbi("netspeedtest/speedtestwan", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Broadband speed test"), 40).leaf = true entry({"admin", "network", "netspeedtest", "speedtestport"},cbi("netspeedtest/speedtestport", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Server Port Latency Test"), 50).leaf = true + entry({"admin", "network", "netspeedtest", "log"}, form("netspeedtest/log"), _("Log"), 60).leaf = true entry({"admin", "network", "netspeedtest", "test_port"}, call("test_port")) entry({"admin", "network", "iperf3_status"}, call("iperf3_status")) entry({"admin", "network", "test_iperf0"}, post("test_iperf0"), nil).leaf = true entry({"admin", "network", "test_iperf1"}, post("test_iperf1"), nil).leaf = true entry({"admin", "network", "netspeedtest", "speedtestwanrun"}, call("speedtestwanrun")) - entry({"admin", "network", "netspeedtest", "realtime_log"}, call("get_log")) + entry({"admin", "network", "netspeedtest", "netcheck"}, call("netcheck")) entry({"admin", "network", "netspeedtest", "dellog"},call("dellog")) + entry({"admin", "network", "netspeedtest", "getlog"},call("getlog")) end +function netcheck() + http.prepare_content("text/plain; charset=utf-8") + local f=io.open("/etc/netspeedtest/netspeedtest.log", "r+") + local fdp=fs.readfile("/etc/netspeedtest/netspeedtestpos") or 0 + f:seek("set",fdp) + local a=f:read(2048000) or "" + fdp=f:seek() + fs.writefile("/etc/netspeedtest/netspeedtestpos",tostring(fdp)) + f:close() + http.write(a) +end + +function speedtestwanrun() + local cli = luci.http.formvalue('cli') + uci:set(name, 'speedtestwan', 'speedtest_cli', cli) + uci:commit(name) + fs.writefile("/etc/netspeedtest/netspeedtestpos","0") + http.prepare_content("application/json") + http.write('') + sys.exec(string.format("/etc/init.d/netspeedtest wantest " ..cli.. " > /etc/netspeedtest/netspeedtest.log 2>&1 &" )) +end function test_port() local e = {} @@ -82,24 +108,25 @@ function test_iperf1(addr) sys.call("/etc/init.d/unblockmusic restart") end -function get_log() - local e = {} - e.running = sys.call("busybox ps -w | grep netspeedtest | grep -v grep >/dev/null") == 0 - e.log = fs.readfile("/var/log/netspeedtest.log") or "" - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end - function dellog() fs.writefile("/var/log/netspeedtest.log","") http.prepare_content("application/json") http.write('') end -function speedtestwanrun() - local cli = luci.http.formvalue('cli') - uci:set(name, 'speedtestwan', 'speedtest_cli', cli) - uci:commit(name) - testout("/etc/init.d/netspeedtest wantest "..cli) + + +function getlog() + logfile="/var/log/netspeedtest.log" + if not fs.access(logfile) then + http.write("") + return + end + local f=io.open(logfile,"r") + local a=f:read("*a") or "" + f:close() + a=string.gsub(a,"\n$","") + http.prepare_content("text/plain; charset=utf-8") + http.write(a) end diff --git a/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/log.lua b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/log.lua new file mode 100644 index 000000000..eac991803 --- /dev/null +++ b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/log.lua @@ -0,0 +1,13 @@ +local fs = require "nixio.fs" +local uci = require"luci.model.uci".cursor() +local f, t +f = SimpleForm("logview") +f.reset = false +f.submit = false +t=f:field(TextValue,"conf") + +t.rmempty=true +t.rows=20 +t.template="netspeedtest/log" +t.readonly="readonly" +return f diff --git a/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestport.lua b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestport.lua index a1c6bec2a..ec67a11c3 100644 --- a/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestport.lua +++ b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestport.lua @@ -21,8 +21,5 @@ e = t:option(DummyValue, '', '') e.rawhtml = true e.template ='netspeedtest/speedtestport' -e =t:option(DummyValue, '', '') -e.rawhtml = true -e.template = 'netspeedtest/log' return o diff --git a/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestwan.lua b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestwan.lua index 34962a96e..b06ab5037 100644 --- a/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestwan.lua +++ b/luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/speedtestwan.lua @@ -12,12 +12,8 @@ e:value("0",translate("ookla-speedtest-cli")) e:value("1",translate("python3-speedtest-cli")) e.default = "1" -e = t:option(DummyValue, '', '') -e.rawhtml = true +e=t:option(Button, "restart", translate("speedtest.net Broadband speed test")) +e.inputtitle=translate("Click to execute") e.template ='netspeedtest/speedtestwan' -e =t:option(DummyValue, '', '') -e.rawhtml = true -e.template = 'netspeedtest/log' - return o diff --git a/luci-app-netspeedtest/luasrc/view/netspeedtest/log.htm b/luci-app-netspeedtest/luasrc/view/netspeedtest/log.htm index 905e2b18f..580ec1e98 100644 --- a/luci-app-netspeedtest/luasrc/view/netspeedtest/log.htm +++ b/luci-app-netspeedtest/luasrc/view/netspeedtest/log.htm @@ -1,16 +1,53 @@ <%+cbi/valueheader%> - + +<%:Reverse%> + - -<%+cbi/valuefooter%> +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/luci-app-netspeedtest/luasrc/view/netspeedtest/speedtestwan.htm b/luci-app-netspeedtest/luasrc/view/netspeedtest/speedtestwan.htm index 7da4bb3e3..872b4ca38 100644 --- a/luci-app-netspeedtest/luasrc/view/netspeedtest/speedtestwan.htm +++ b/luci-app-netspeedtest/luasrc/view/netspeedtest/speedtestwan.htm @@ -3,24 +3,32 @@ https://github.com/sirpdboy/netspeedtest Licensed to the public under the Apache License 2.0. -%> + <%+cbi/valueheader%> - - - -
- +<%local fs=require"nixio.fs"%> + + - - +function poll_check(){ +var tag = document.getElementById('logview'); +tag.style.display="block" +XHR.poll(3, '<%=url([[admin]], [[network]], [[netspeedtest]], [[netcheck]])%>', null, + function(x, data) { + var lv = document.getElementById('cbid.logview.test.conf'); + if (x.responseText && lv) { + if (x.responseText=="\u0000"){ + for(j = 0,len=this.XHR._q.length; j < len; j++) { + if (this.XHR._q[j].url == '<%=url([[admin]], [[network]], [[netspeedtest]], [[netcheck]])%>'){ + this.XHR._q.splice(j,1); + checkbtn.disabled = false; + checkbtn.value = '<%:Click to execute%>'; + break; + } + } + return + } + if (islogreverse){ + lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML; + }else{ + lv.innerHTML += x.responseText; + } + } + } +);} + +//]]> + <%+cbi/valuefooter%> diff --git a/luci-app-netspeedtest/root/etc/init.d/netspeedtest b/luci-app-netspeedtest/root/etc/init.d/netspeedtest index 0fd8a2a27..eff8cf2ff 100755 --- a/luci-app-netspeedtest/root/etc/init.d/netspeedtest +++ b/luci-app-netspeedtest/root/etc/init.d/netspeedtest @@ -15,7 +15,15 @@ EXTRA_COMMANDS="wantest" TMP_T=/var/netspeedtest_nstest.tmp BINSPEEDTEST='/usr/bin/speedtest' LOCK=/var/lock/netspeedtest_nstest.lock +LOGD=/etc/netspeedtest LOG=/var/log/netspeedtest.log +LOGE=$LOGD/netspeedtest.log +LOGT=$LOGD/netspeedtestpos +[ -d "$LOGD" ] || mkdir -p $LOGD +[ -f "$LOGE" ] || echo "start" > $LOG +[ -f "$LOGT" ] || echo "start" > $LOGT +[ -f "$LOG" ] || echo "start" > $LOG + MAX_LOG=500 limit_log() { local logf=$1 @@ -29,10 +37,6 @@ limit_log() { fi } -init_log() { - local logf=$1 - [ ! -f "$logf" ] && echo "" > $logf -} echone() { echo -ne $* >> $LOG @@ -42,46 +46,50 @@ echone() { wantest() { [ -f $LOCK ] && exit limit_log $LOG 500 - init_log $LOG touch $LOCK TESTMODE=$1 BINTEMP=$(git_bin_handle $TESTMODE) - # [ -n "$BINTEMP" ] || return - # echone "\n BINTEMP: $BINTEMP " case $TESTMODE in 0) - echo -ne "\n —————ookla-speedtest测速$TESTMODE—————" >> $LOG - info=$($BINTEMP > $TMP_T 2>&1 ) - RESULT=$(echo "$TMP_T" | grep "URL" | awk '{print $NF}') + echo -ne "\n —————ookla-speedtest测速—————\n" | tee -a $LOG + $BINTEMP | tee $TMP_T + RESULT=$(cat $TMP_T | grep 'URL' | cut -c15-) if [ -n "$RESULT" ] ;then echo -ne "\n 测服信息:`cat $TMP_T | grep 'Server'| cut -c10- | awk -F: '{printf $2$3}'` 线路:`cat $TMP_T | grep 'ISP' | awk -F: '{printf $2}' ` 延时:`cat $TMP_T | grep 'Latency' | awk -F: '{printf $2}' | awk -F '(' '{printf $1}'`" >> $LOG echo -ne "\n 下行速率:`cat $TMP_T | grep 'Download' |awk -F: '{printf $2}' | awk -F '(' '{printf $1}'` --" >> $LOG echo -ne "-- 上行速率:`cat $TMP_T | grep 'Upload' |awk -F: '{printf $2}' | awk -F '(' '{printf $1}'`" >> $LOG echo -ne "\n 测速结果图片链接:`cat $TMP_T | grep 'URL' | cut -c15-`" >> $LOG - echo -ne "$RESULT" else - echo -ne "\n 因客户端在LUCI状态下无法执行,测试失败!" >> $LOG - echo -ne "\n 请SSH登陆后输入 :/etc/init.d/netspeedtest wantest 0 然后等完成后,刷新后查看记录!" >> $LOG + echo -ne "\n 因客户端在LUCI下运行错误,测试失败!" | tee -a $LOG + echo -ne "\n 请SSH运行:/etc/init.d/netspeedtest wantest 0 测试,完成后,在日志中有测试结果!" | tee -a $LOG fi - echo -ne "\n 测试时间: `date +%Y-%m-%d' '%H:%M:%S`" >> $LOG - echo -ne "\n ————————————————————\n" >> $LOG + echo -ne "\n 测试时间: `date +%Y-%m-%d' '%H:%M:%S`" | tee -a $LOG + echo -ne "\n ————————————————————\n" | tee -a $LOG ;; - *) - echo -ne "\n —————python3-speedtest测速$TESTMODE—————" >> $LOG - info=$($BINTEMP > $TMP_T 2>&1 ) + *) + echo -ne "\n —————python3-speedtest测速—————\n" | tee -a $LOG + $BINTEMP | tee $TMP_T echo -ne "\n 测服信息:$(cat $TMP_T | grep 'Hosted by'| cut -c10- | awk -F: '{printf $1}') 延时:$(cat $TMP_T | grep 'Hosted by' | awk -F: '{printf $2}')" >> $LOG - echo -ne "\n 下行速率:$(cat $TMP_T | grep 'Download:' |awk -F: '{printf $2}' )" >> $LOG - echo -ne " ---- 上行速率:$(cat $TMP_T | grep 'Upload:' |awk -F: '{printf $2}' )" >> $LOG + echo -ne "\n 下行速率:$(cat $TMP_T | grep 'Download:' |awk -F: '{printf $2}' ) --" >> $LOG + echo -ne "-- 上行速率:$(cat $TMP_T | grep 'Upload:' |awk -F: '{printf $2}' )" >> $LOG echo -ne "\n 测试结果图片链接:$(cat $TMP_T | grep 'results:' | cut -c16- )" >> $LOG - echo -ne "\n 测试时间:`date +%Y-%m-%d" "%H:%M:%S`" >> $LOG - echo -ne "\n ————————————————————\n" >> $LOG - echo -ne $(cat $TMP_T | grep 'results:' | awk '{print $NF}') + echo -ne "\n 测试时间:`date +%Y-%m-%d" "%H:%M:%S`" | tee -a $LOG + echo -ne "\n ————————————————————\n" | tee -a $LOG ;; esac rm -f $LOCK } - +getcpucore(){ +#i386, x86_64, arm32, arm32hf, and arm64. + cputype=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]') + [ -n "$(echo $cputype | grep -E "linux.*armv.*")" ] && cpucore="armel" + [ -n "$(echo $cputype | grep -E "linux.*armv7.*")" ] && [ -n "$(cat /proc/cpuinfo | grep vfp)" ] && [ ! -d /jffs/clash ] && cpucore="armhf" + [ -n "$(echo $cputype | grep -E "linux.*aarch64.*|linux.*armv8.*")" ] && cpucore="aarch64" + [ -n "$(echo $cputype | grep -E "linux.*86.*")" ] && cpucore="i386" + [ -n "$(echo $cputype | grep -E "linux.*86_64.*")" ] && cpucore="x86_64" +echo $cpucore +} git_bin_handle() { @@ -95,7 +103,7 @@ case $1 in chmod 755 $BINSPEEDTEST >/dev/null 2>&1 echo "$BINSPEEDTEST --accept-gdpr --accept-license --progress=no" else - ooklaurl=`curl --connect-timeout 5 -m 60 -sSL 'https://www.speedtest.net/apps/cli' | grep 'Download for Linux' | sed 's|<|\n<|g' | sed -n '/Download for Linux/,/<\/div>/p' | sed -En "s|.*x86_64|\1|p" ` + ooklaurl=`curl --connect-timeout 5 -m 60 -sSL 'https://www.speedtest.net/apps/cli' | grep 'Download for Linux' | sed 's|<|\n<|g' | sed -n '/Download for Linux/,/<\/div>/p' | sed -En "s|.*$(getcpucore)|\1|p" ` [ -n "$ooklaurl" ] && curl -sSL $ooklaurl | tar -xvz -C /tmp >/dev/null 2>&1 || return mv /tmp/speedtest $BINSPEEDTEST >/dev/null 2>&1 chmod 755 $BINSPEEDTEST >/dev/null 2>&1 diff --git a/luci-app-netspeedtest/root/etc/uci-defaults/40_luci-netspeedtest b/luci-app-netspeedtest/root/etc/uci-defaults/40_luci-netspeedtest index ef606f4a2..55efe0716 100644 --- a/luci-app-netspeedtest/root/etc/uci-defaults/40_luci-netspeedtest +++ b/luci-app-netspeedtest/root/etc/uci-defaults/40_luci-netspeedtest @@ -1,9 +1,18 @@ #!/bin/sh chmod +x /etc/init.d/netspeedtest >/dev/null 2>&1 +[ `uci -q get partexp.global` ] && uci set partexp.global=global [ `uci -q get netspeedtest.netspeedtest` ] || uci set netspeedtest.netspeedtest=netspeedtest [ `uci -q get netspeedtest.speedtestiperf3` ] || uci set netspeedtest.speedtestiperf3=speedtestiperf3 [ `uci -q get netspeedtest.speedtestport` ] || uci set netspeedtest.speedtestport=speedtestport [ `uci -q get netspeedtest.speedtestwan` ] || uci set netspeedtest.speedtestport=speedtestwan +LOGD=/etc/netspeedtest +LOG=/var/log/netspeedtest.log +LOGE=$LOGD/netspeedtest.log +LOGT=$LOGD/netspeedtestpos +[ -d "$LOGD" ] || mkdir -p $LOGD +[ -f "$LOGE" ] || echo "start" > $LOG +[ -f "$LOGT" ] || echo "start" > $LOGT +[ -f "$LOG" ] || echo "start" > $LOG rm -rf /tmp/luci-modulecache /tmp/luci-indexcache* exit 0