[openwrt/openwrt] base-files: fix status display command

LEDE Commits lede-commits at lists.infradead.org
Sun Apr 18 13:15:32 BST 2021


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/eaf19220b67d83c4c596fa21890abf5af9b4a610

commit eaf19220b67d83c4c596fa21890abf5af9b4a610
Author: Alexander Egorenkov <egorenar-dev at posteo.net>
AuthorDate: Sun Mar 28 10:45:08 2021 +0200

    base-files: fix status display command
    
    If service() is called w/o parameter then the status display for services
    with multiple instances is incorrect. E.g. samba4 or wpad have 2 instances.
    
    root at OpenWrt:~# /etc/init.d/samba4 status
    running
    root at OpenWrt:~# /etc/init.d/wpad status
    running
    
    Before change:
    /etc/init.d/samba4                 enabled         stopped
    /etc/init.d/wpad                   enabled         stopped
    
    After change:
    /etc/init.d/samba4                 enabled         running
    /etc/init.d/wpad                   enabled         running
    
    Signed-off-by: Alexander Egorenkov <egorenar-dev at posteo.net>
    (cherry picked from commit 9318f61556c5443eb66eec7e26715b00f0df86fc)
---
 package/base-files/files/etc/shinit | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/shinit b/package/base-files/files/etc/shinit
index 8c64e81563..0a1ebcc832 100644
--- a/package/base-files/files/etc/shinit
+++ b/package/base-files/files/etc/shinit
@@ -22,7 +22,7 @@ service() {
 			printf "%-30s\t%10s\t%10s\n"  "$F" \
 			$( $($F enabled) && echo "enabled" || echo "disabled" ) \
 			$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \
-			| jsonfilter -q -e "@.$(basename $F).instances[*].running")" = "true" ] \
+			| jsonfilter -q -e "@.$(basename $F).instances[*].running" | uniq)" = "true" ] \
 			&& echo "running" || echo "stopped" )
 		done;
 		return 1



More information about the lede-commits mailing list