b/package/base-files/files/etc/rc.common
@@ -67,13 +67,14 @@ help() {
Syntax: $initscript [command]
Available commands:
- start Start the service
- stop Stop the service
- restart Restart the service
- reload Reload configuration files (or restart if service does not
implement reload)
- enable Enable service autostart
- disable Disable service autostart
+ start Start the service
+ stop Stop the service
+ restart Restart the service
+ reload Reload configuration files (or restart if service does not
implement reload)
+ enable Enable service autostart
+ disable Disable service autostart
enabled Check if service is started on boot
+ status-ubus Show ubus info for the service
$EXTRA_HELP
Implement $initscript status-ubus as a short-hand for ubus call service list "{'name': '$initscript'}" Signed-off-by: Stan Grishin <stangri@melmac.net> --- package/base-files/files/etc/rc.common | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) EOF } @@ -165,6 +166,13 @@ ${EXTRA_HELP}" } } -ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}" -list_contains ALL_COMMANDS "$action" || action=help +status_ubus() { + name="$(basename "${initscript}")" + /bin/ubus call service list "{'name': '$name'}" + return 0 +} + +ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends status-ubus ${EXTRA_COMMANDS}" +list_contains ALL_COMMANDS "$action" && action="${action/-/_}" || action=help $action "$@" +