From: Petr Štetiar Date: Tue, 23 Jul 2019 10:06:29 +0000 (+0200) Subject: base-files: implement generic service_running X-Git-Tag: v21.02.0-rc1~5030 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ed5b9129d7a47adaecdce694cec8e7b61131a9da;p=openwrt%2Fopenwrt.git base-files: implement generic service_running DRY is good, otherwise we're going to suffer with a copy&paste disease in the init scripts. Signed-off-by: Petr Štetiar --- diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index 75dbeedf34..37adab0c54 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -95,7 +95,9 @@ service_data() { } service_running() { - return 0 + local service="${1:-$(basename $initscript)}" + local instance="${2:-*}" + procd_running "$service" "$instance" "$@" } ${INIT_TRACE:+set -x} @@ -104,6 +106,9 @@ ${INIT_TRACE:+set -x} [ -n "$USE_PROCD" ] && { EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace" + EXTRA_HELP="\ + running Check if service is running + " . $IPKG_INSTROOT/lib/functions/procd.sh basescript=$(readlink "$initscript")