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> Part of the commit content is already in system/procd/files.
This commit is contained in:
parent
81f41e0d58
commit
06a87652ff
@ -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}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user