From 30d7a4cadfd3ebf460927a5fe0108a448cb789d9 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 24 Apr 2019 13:49:35 +0800 Subject: [PATCH] luci app vlmcsd: update to fit new luci --- package/lean/luci-app-vlmcsd/Makefile | 2 +- package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua | 2 +- .../lean/luci-app-vlmcsd/root/etc/init.d/{vlmcsd => kms} | 8 +++----- .../luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) rename package/lean/luci-app-vlmcsd/root/etc/init.d/{vlmcsd => kms} (85%) diff --git a/package/lean/luci-app-vlmcsd/Makefile b/package/lean/luci-app-vlmcsd/Makefile index 7e7bf8f80..2bb1feb9c 100644 --- a/package/lean/luci-app-vlmcsd/Makefile +++ b/package/lean/luci-app-vlmcsd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI page for KMS LUCI_DEPENDS:=+vlmcsd PKG_VERSION:=1.0 -PKG_RELEASE:=3 +PKG_RELEASE:=5 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua index 0bb6668c1..f540847cb 100644 --- a/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua +++ b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua @@ -13,7 +13,7 @@ end function act_status() local e={} - e.running=nixio.fs.access("/var/run/vlmcsd.pid") + e.running=luci.sys.call("pgrep vlmcsd >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end diff --git a/package/lean/luci-app-vlmcsd/root/etc/init.d/vlmcsd b/package/lean/luci-app-vlmcsd/root/etc/init.d/kms similarity index 85% rename from package/lean/luci-app-vlmcsd/root/etc/init.d/vlmcsd rename to package/lean/luci-app-vlmcsd/root/etc/init.d/kms index 09d2ac9a1..7878239e1 100755 --- a/package/lean/luci-app-vlmcsd/root/etc/init.d/vlmcsd +++ b/package/lean/luci-app-vlmcsd/root/etc/init.d/kms @@ -1,7 +1,6 @@ #!/bin/sh /etc/rc.common # Copyright (c) 2011-2015 OpenWrt.org -PIDFILE=/var/run/vlmcsd.pid START=90 get_config() { @@ -30,7 +29,7 @@ start() { config_load vlmcsd config_foreach get_config vlmcsd [ $enabled -eq 0 ] && exit 0 - /usr/bin/vlmcsd -i /etc/vlmcsd.ini -L 0.0.0.0:1688 -p $PIDFILE + /usr/bin/vlmcsd -i /etc/vlmcsd.ini -L 0.0.0.0:1688 echo "KMS Server has started." if [ $autoactivate -eq 1 ]; then @@ -51,8 +50,7 @@ start() { } stop() { - pid=`cat $PIDFILE` - kill $pid || kill -9 $pid - echo "KMS Server has stopped." + killall -q -9 vlmcsd + echo "KMS Server has stopped." } diff --git a/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd b/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd index c1b0882cc..d28b2ec9f 100755 --- a/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd +++ b/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd @@ -3,7 +3,7 @@ uci -q batch <<-EOF >/dev/null delete ucitrack.@vlmcsd[-1] add ucitrack vlmcsd - set ucitrack.@vlmcsd[-1].init=vlmcsd + set ucitrack.@vlmcsd[-1].init=kms commit ucitrack EOF