aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>2018-09-11 22:35:09 -0300
committerPetr Štetiar <ynezz@true.cz>2019-09-15 22:53:01 +0200
commit7519a36774ca0e50dfae6a4b9fea75cab95171a5 (patch)
treecad59cdd370e0c6d04013cb92d2d45c0a22b7757 /package/base-files
parented5b9129d7a47adaecdce694cec8e7b61131a9da (diff)
downloadupstream-7519a36774ca0e50dfae6a4b9fea75cab95171a5.tar.gz
upstream-7519a36774ca0e50dfae6a4b9fea75cab95171a5.tar.bz2
upstream-7519a36774ca0e50dfae6a4b9fea75cab95171a5.zip
base-files,procd: add generic service status
Adds a default status action for init.d scripts. procd "service status" will return: 0) for loaded services (even if disabled by conf or dead) 3) for inactive services 4) when filtering a non-existing instance Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> [rebased, cleaned up] Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/etc/rc.common11
1 files changed, 10 insertions, 1 deletions
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index 37adab0c54..d3fa3be505 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -105,9 +105,10 @@ ${INIT_TRACE:+set -x}
. "$initscript"
[ -n "$USE_PROCD" ] && {
- EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace"
+ EXTRA_COMMANDS="${EXTRA_COMMANDS} running status trace"
EXTRA_HELP="\
running Check if service is running
+ status Service status
"
. $IPKG_INSTROOT/lib/functions/procd.sh
@@ -153,6 +154,14 @@ ${INIT_TRACE:+set -x}
running() {
service_running "$@"
}
+
+ status() {
+ if eval "type status_service" 2>/dev/null >/dev/null; then
+ status_service "$@"
+ else
+ _procd_status "$(basename ${basescript:-$initscript})" "$1"
+ fi
+ }
}
ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"