diff --git a/package/lean/luci-app-xlnetacc/Makefile b/package/lean/luci-app-xlnetacc/Makefile index b26805b0a..d863c3592 100644 --- a/package/lean/luci-app-xlnetacc/Makefile +++ b/package/lean/luci-app-xlnetacc/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-xlnetacc PKG_VERSION:=1.0.3 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_LICENSE:=GPLv2 PKG_MAINTAINER:=Sense diff --git a/package/lean/luci-app-xlnetacc/files/luci/controller/xlnetacc.lua b/package/lean/luci-app-xlnetacc/files/luci/controller/xlnetacc.lua index 65fbcb921..ab9d92947 100644 --- a/package/lean/luci-app-xlnetacc/files/luci/controller/xlnetacc.lua +++ b/package/lean/luci-app-xlnetacc/files/luci/controller/xlnetacc.lua @@ -18,14 +18,14 @@ function index() entry({"admin", "services", "xlnetacc", "logdata"}, call("action_log")) end -local function is_running(name) - return luci.sys.call("pidof %s >/dev/null" %{name}) == 0 +local function is_running() + return luci.sys.call("(ps | grep xlnetacc.sh | grep -v 'grep') >/dev/null" ) == 0 end function action_status() luci.http.prepare_content("application/json") luci.http.write_json({ - run_state = is_running("xlnetacc.sh"), + run_state = is_running(), down_state = nixio.fs.readfile("/var/state/xlnetacc_down_state") or "", up_state = nixio.fs.readfile("/var/state/xlnetacc_up_state") or "" }) diff --git a/package/lean/luci-app-xlnetacc/files/luci/view/xlnetacc/status.htm b/package/lean/luci-app-xlnetacc/files/luci/view/xlnetacc/status.htm index 4af0731d0..3da9c4422 100644 --- a/package/lean/luci-app-xlnetacc/files/luci/view/xlnetacc/status.htm +++ b/package/lean/luci-app-xlnetacc/files/luci/view/xlnetacc/status.htm @@ -13,7 +13,7 @@ var up_state = document.getElementById('_up_state'); XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "xlnetacc", "status")%>', null, function(x, status) { if ( x && x.status == 200 ) { - run_state.innerHTML = status.run_state ? '<%:RUNNING%>' : '<%:NOT RUNNING%>'; + run_state.innerHTML = status.run_state ? '<%:RUNNING%>' : '<%:NOT RUNNING%>'; down_state.innerHTML = status.down_state ? status.down_state : '<%:No upgrade information%>'; up_state.innerHTML = status.up_state ? status.up_state : '<%:No upgrade information%>'; } diff --git a/package/lean/luci-app-xlnetacc/files/root/etc/init.d/xlnetacc b/package/lean/luci-app-xlnetacc/files/root/etc/init.d/xlnetacc index e41e825dd..d15628113 100644 --- a/package/lean/luci-app-xlnetacc/files/root/etc/init.d/xlnetacc +++ b/package/lean/luci-app-xlnetacc/files/root/etc/init.d/xlnetacc @@ -27,15 +27,15 @@ start() { } stop() { - pidof "${NAME}.sh" >/dev/null 2>&1 || return 1 + ps | grep xlnetacc.sh | grep -v 'grep' >/dev/null 2>&1 || return 1 local pid spid - for pid in $(pidof "${NAME}.sh"); do + for pid in $(ps | grep xlnetacc.sh | grep -v 'grep' | awk '{print $1}'); do echo "Stop XLNetAcc process PID: $pid" - kill $pid >/dev/null 2>&1 + kill -9 $pid >/dev/null 2>&1 for spid in $(pgrep -P $pid "sleep"); do echo "Stop XLNetAcc process SPID: $spid" - kill $spid >/dev/null 2>&1 + kill -9 $spid >/dev/null 2>&1 done done logger -p "daemon.notice" -t "$NAME" "XLNetAcc has stoped." @@ -43,6 +43,7 @@ stop() { } restart() { + rm -rf /tmp/state/xlnetacc* stop && sleep 1 start }