update 2024-03-23 04:15:49

This commit is contained in:
kenzok8 2024-03-23 04:15:49 +08:00
parent e145554a4e
commit 860cff1426
14 changed files with 226 additions and 124 deletions

View File

@ -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() {

View File

@ -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

View File

@ -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"))

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,7 @@
-- Copyright (C) 2020-2022 sirpdboy <herboy2008@gmail.com> 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,16 +1,53 @@
<%+cbi/valueheader%>
<textarea id="logview.list" class="cbi-input-textarea" style="width: 100%" rows="20" readonly="readonly"></textarea>
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:Clear Log%>" onclick="apply_del_log()"/>
<input type="checkbox" name="NAME" value="reverse" onclick="reverselog()" style="vertical-align:middle;height:auto;"><%:Reverse%></input>
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
<script type="text/javascript">
const LOG_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","realtime_log")%>';
<script type="text/javascript">//<![CDATA[
var islogreverse=false;
XHR.poll(1, LOG_URL, null, (x, d) => {
let logview = document.getElementById("logview.list");
if (!d.running) {
XHR.halt();
}
logview.value = d.log;
logview.scrollTop = logview.scrollHeight;
});
function createAndDownloadFile(fileName,content){
var aTag=document.createElement('a');
var blob=new Blob([content]);
aTag.download=fileName;
aTag.href=URL.createObjectURL(blob);
aTag.click();
URL.revokeObjectURL(blob);
}
function apply_del_log(){
XHR.get('<%=url([[admin]],[[network]],[[netspeedtest]],[[dellog]])%>',null,function(x,data){
var lv=document.getElementById('cbid.logview.1.conf');
lv.innerHTML="";
}
);
return
}
function reverselog(){
var lv=document.getElementById('cbid.logview.1.conf');
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
if (islogreverse){
islogreverse=false;
}else{
islogreverse=true;
}
return
}
XHR.poll(3,'<%=url([[admin]],[[network]],[[netspeedtest]],[[getlog]])%>',null,
function(x,data){
var lv=document.getElementById('cbid.logview.1.conf');
lv.innerHTML=""
if (x.responseText && lv){
if (islogreverse){
lv.innerHTML=x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
}else{
lv.innerHTML+=x.responseText;
}
}
}
)
//]]>
</script>
<%+cbi/valuefooter%>
<%+cbi/valuefooter%>

View File

@ -3,24 +3,32 @@
https://github.com/sirpdboy/netspeedtest
Licensed to the public under the Apache License 2.0.
-%>
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("speedtest.net Broadband speed test") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-apply" id="run_service" type="button" onclick="run(this)" value="<%=translate('Click to execute') %>" />
<%local fs=require"nixio.fs"%>
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_run_button" value="<%:Click to execute%>" onclick=" return apply_run(this) "/>
<div id="logview" style="display:none">
<input type="checkbox" id="reversetag" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;"><%:reverse%></input>
<textarea id="cbid.logview.test.conf" class="cbi-input-textarea" style="width: 100%;display:block;" data-update="change" rows="20" cols="80" readonly="readonly" > </textarea>
</div>
<fieldset class="cbi-section" style="display:none">
<legend id="wanspeedtest-legend">
<%:Collecting data...%>
</legend>
<span id="wanspeedtest-output"></span>
</fieldset>
<script type="text/javascript">
function run(btn) {
<script type="text/javascript">//<![CDATA[
const RUN_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","speedtestwanrun")%>';
const S_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","speedtestwan")%>';
const S_URL = '<%=luci.dispatcher.build_url("admin", "network", "netspeedtest","netcheck")%>';
var checkbtn = document.getElementById('apply_run_button');
var islogreverse = false;
function reverselog(){
var lv = document.getElementById('cbid.logview.test.conf');
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
if (islogreverse){
islogreverse=false;
}else{
islogreverse=true;
}
return
}
function apply_run(btn) {
var sid='speedtestwan'
var opt={
base:"cbid.netspeedtest."+sid,
@ -47,40 +55,45 @@ function run(btn) {
return ret;
}
}
var legend=document.getElementById('wanspeedtest-legend');
var output=document.getElementById('wanspeedtest-output');
btn.value='<%:Waiting (executing)...%>';
btn.disabled=true;
var cli=opt.get("speedtest_cli").value;
console.log(cli);
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Network speed test, please wait...%>'
;
XHR.get(RUN_URL, { cli: cli },
(x) =>{
if (x.responseText)
{
legend.style.display = 'none';
output.innerHTML = String.format('<img src=%h height="300" style="vertical-align:middle" />', x.responseText);
}
else
{
legend.style.display = 'none';
output.innerHTML ='</p><%:Operation execution complete%></p>';
}
btn.disabled=false;
btn.value='<%:Click to execute%>';
}
(x) =>{}
);
return false;
poll_check();
return;
}
</script>
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;
}
}
}
);}
//]]>
</script>
<%+cbi/valuefooter%>

View File

@ -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|.*<a href=\"([^\"]+)\">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|.*<a href=\"([^\"]+)\">$(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

View File

@ -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