From 1ebdae062921a74df3dbd6744b82efdd2b9ba1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=90=E8=AF=9D?= <49544781+xiaomeng9597@users.noreply.github.com> Date: Thu, 20 Jun 2024 00:21:12 +0800 Subject: [PATCH] update httpubus --- configfiles/httpubus | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/configfiles/httpubus b/configfiles/httpubus index a0a82e3..90afd70 100644 --- a/configfiles/httpubus +++ b/configfiles/httpubus @@ -3,14 +3,31 @@ START=99 STOP=11 +board_name() { + [ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic" +} + +check_model() { + local board=$(board_name) + case "$board" in + jp,tvbox|\ + panther,x2) + /sbin/ubus-status.sh > /dev/null 2>&1 & + ;; + *) + return 1 + ;; + esac +} + start() { - /sbin/ubus-status.sh > /dev/null 2>&1 & + check_model } stop() { - pid=$(pgrep "ubus-status" | head -n 1) - if [ -n "$pid" ]; then - kill -9 "$pid" + pidcount=$(pgrep "ubus-status" | wc -l) + if [ "$pidcount" -eq 1 ]; then + killall -9 ubus-status fi }