Commit graph

17 commits

Author SHA1 Message Date
Rafał Miłecki
646daa0bec 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>
2020-09-10 13:18:09 +02:00
Jo-Philipp Wich
7235f34895 plugin: store pointer to exec timeout value in the ops structure
This is required for plugins that need access to the configured execution
timeout. The global variable cannot be used as-is since we dlopen() with
RTLD_LOCAL.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-28 12:10:40 +01:00
Jo-Philipp Wich
ccd7c0af75 treewide: rename exec_timeout to rpc_exec_timeout
Rename the extern int to denote a global symbol.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-28 12:07:58 +01:00
Jo-Philipp Wich
ecd1660f17 exec: increase maximum execution time to 120s
Increase the maximum possible execution time to 120 seconds and add a new
command line flag `-t` which allows overwriting the default value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 14:28:28 +01:00
Jo-Philipp Wich
3d400c723b session: support reclaiming pending apply session
Reclaim the pending apply session upon login when the username matches the
current login.

This is required to support apply-confirm-rollback workflow for ubus browser
clients, since changing IPs requires re-login to the device due to cross
domain restrictions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-15 12:29:15 +01:00
John Crispin
b71df5b75f fix for json 0.12
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-08 15:04:13 +01:00
Felix Fietkau
c1ed6d7856 plugin.h: explicitly include json.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-04 19:54:58 +02:00
Luka Perkov
ec21f653b9 fix whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-29 13:29:32 +00:00
Jo-Philipp Wich
0c4e97b4e7 Extend copyright 2014-01-12 12:48:58 +00:00
Jo-Philipp Wich
5a101fcc08 session: setup a persistent NULL section and implement login procedure 2013-09-10 19:56:36 +02:00
John Crispin
6f78bfbbdf add config transaction support
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-09-06 01:42:02 +02:00
Jo-Philipp Wich
334a067a74 Fix rpcd includes in plugin.h 2013-09-05 17:00:23 +02:00
Jo-Philipp Wich
fa53571f2b Use common /var/run/rpcd base directory to store runtime information 2013-09-05 15:14:00 +02:00
Jo-Philipp Wich
fc1b008e08 uci: expose rpc_uci_purge_savedirs() helper 2013-09-05 14:38:01 +02:00
Jo-Philipp Wich
524032c291 main: store session data to disk on receipt of SIGUSR1 or SIGHUP. On HUP terminate self and re-exec 2013-09-05 14:37:56 +02:00
Jo-Philipp Wich
aa2afdb739 session: add support for saving and restoring session data to disk 2013-09-04 17:08:56 +02:00
Jo-Philipp Wich
e0afdb10ae Move includes into subdirectory 2013-09-04 12:46:11 +02:00