rc: new ubus object for handling /etc/init.d/ scripts
authorRafał Miłecki <rafal@milecki.pl>
Tue, 23 Jun 2020 18:46:19 +0000 (20:46 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 10 Sep 2020 11:18:09 +0000 (13:18 +0200)
commit646daa0bec742e4c0af010ca85eda9021d95e4cf
tree240bfff1bfc0737d0e7a1d709ad609c82be61e46
parent078bb57e0769c987c05244abe1f7d8d53e0e323e
rc: new ubus object for handling /etc/init.d/ scripts

This commit adds "rc" ubus object with methods "list" and "exec" for
listing and calling init.d script appropriately. It's useful for all
kind of UIs (e.g. LuCI) and custom apps.

Example:
root@OpenWrt:~# ubus call rc list
{
"blockd": {
"start": 80,
"enabled": true,
"running": true
},
"dnsmasq": {
"start": 19,
"enabled": true,
"running": true
}
}
root@OpenWrt:~# ubus call rc init '{ "name": "blockd", "action": "disable" }'
root@OpenWrt:~# ubus call rc init '{ "name": "dnsmasq", "action": "stop" }'
root@OpenWrt:~# ubus call rc list
{
"blockd": {
"start": 80,
"enabled": false,
"running": true
},
"dnsmasq": {
"start": 19,
"enabled": true,
"running": false
}
}

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
CMakeLists.txt
include/rpcd/rc.h [new file with mode: 0644]
main.c
rc.c [new file with mode: 0644]