Skip to content

Commit

Permalink
base-files: add wrapper for procd service list command
Browse files Browse the repository at this point in the history
A service managed by procd does have a json object with usefull information.
This information could by dumped with the following command.

ubus call service list "{ 'verbose':true, 'name': '<service-name>)'". }"

This line is long and complicated to enter. This commit adds a wrapper
call to the procd service section tool to simplify the input and get the
output faster.

We could now enter the command /etc/initd/<service> info to get the info
faster.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
  • Loading branch information
feckert authored and hauke committed Mar 19, 2022
1 parent b901738 commit 09c41ea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package/base-files/files/etc/rc.common
Expand Up @@ -126,6 +126,7 @@ extra_command "enabled" "Check if service is started on boot"
extra_command "running" "Check if service is running"
extra_command "status" "Service status"
extra_command "trace" "Start with syscall trace"
extra_command "info" "Dump procd service info"

. $IPKG_INSTROOT/lib/functions/procd.sh
basescript=$(readlink "$initscript")
Expand All @@ -149,6 +150,13 @@ extra_command "enabled" "Check if service is started on boot"
start "$@"
}

info() {
json_init
json_add_string name "$(basename ${basescript:-$initscript})"
json_add_boolean verbose "1"
_procd_ubus_call list
}

stop() {
procd_lock
stop_service "$@"
Expand Down

0 comments on commit 09c41ea

Please sign in to comment.