Services action: handle and list services that are managed by Plinth
Created by: fonfon
This is the first part of a service overhaul. It introduces an action script to list plinth services, and handle (enable/disable/..) them.
- API: start, stop, enable, disable, reload, is-running, is-enabled, list
- only allows access to a service if the service name is listed in a 'managed_services' variable of any plinth module.
For demonstration, the services of quassel and transmission are marked as managed:
fonfon@freedombox:~/code/plinth$ sudo actions/service list
{"transmission-daemon": {"running": false}, "quasselcore": {"running": false}}
fonfon@freedombox:~/code/plinth$ sudo actions/service enable transmission-daemon
[...]
fonfon@freedombox:~/code/plinth$ sudo actions/service list
{"quasselcore": {"running": false}, "transmission-daemon": {"running": true}}
The next part is to adapt plinth.Service
to make full use of this action script.
Then I'll come up with a generic ServiceView and ServiceForm.
See also https://github.com/fonfon/Plinth/pull/2 and https://github.com/freedombox/Plinth/issues/415