|
@@ -57,15 +57,21 @@ function act_status()
|
|
|
end
|
|
|
function do_update()
|
|
|
fs.writefile("/var/run/lucilogpos","0")
|
|
|
+ http.prepare_content("application/json")
|
|
|
+ http.write('')
|
|
|
local arg
|
|
|
if luci.http.formvalue("force") == "1" then
|
|
|
arg="force"
|
|
|
else
|
|
|
arg=""
|
|
|
end
|
|
|
- luci.sys.exec("(rm /var/run/update_core_error ; touch /var/run/update_core ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 || touch /var/run/update_core_error ;rm /var/run/update_core) &")
|
|
|
- http.prepare_content("application/json")
|
|
|
- http.write('')
|
|
|
+ if fs.access("/var/run/update_core") then
|
|
|
+ if arg=="force" then
|
|
|
+ luci.sys.exec("kill $(pgrep /usr/share/AdGuardHome/update_core.sh) ; (rm /var/run/update_core_error ; touch /var/run/update_core ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 || touch /var/run/update_core_error ;rm /var/run/update_core) &")
|
|
|
+ end
|
|
|
+ else
|
|
|
+ luci.sys.exec("(rm /var/run/update_core_error ; touch /var/run/update_core ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 || touch /var/run/update_core_error ;rm /var/run/update_core) &")
|
|
|
+ end
|
|
|
end
|
|
|
function get_log()
|
|
|
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
|