From e02542189a0a7349e5010c11e0eefd3bf674ea19 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sat, 2 Nov 2024 01:17:05 +0100 Subject: [PATCH] docs: Add basic user-services documentation. --- service-script-guide.md | 6 ++++++ user-guide.md | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/service-script-guide.md b/service-script-guide.md index 68ee7a684..22fb561e7 100644 --- a/service-script-guide.md +++ b/service-script-guide.md @@ -509,3 +509,9 @@ This is a sensible default for daemons that are happy with `0.0.0.0`, but lets the user specify something else, like `rc_need="net.wan"` if he needs it. The burden is on the user to determine the appropriate service whenever he changes the daemon's configuration file. + +# User services + +User services are ran as the user that starts them. A few things to note +then, are that command_user shouldn't be set, runtime data (such as pidfiles +and sockets) should be placed in XDG_RUNTIME_DIR. diff --git a/user-guide.md b/user-guide.md index 8547b893b..a60081402 100644 --- a/user-guide.md +++ b/user-guide.md @@ -176,3 +176,21 @@ OpenRC has wrappers for many common output tasks in libeinfo. This allows to print colour-coded status notices and other things. To make the output consistent the bundled service scripts all use ebegin/eend to print nice messages. + +# User services + +OpenRC supports managing services for users. + +The init scripts are loaded from /etc/user.d/init.d, and +${XDG_CONFIG_HOME}/openrc/init.d with ~/.config should XDG_CONFIG_HOME be unset. + +Configurations in ~/.config/openrc/conf.d should overwrite /etc/user.d/conf.d, +and similarly options set in ~/.config/openrc/rc.conf overrides /etc/rc.conf. + +Runlevels are kept in ~/.config/openrc/runlevels. + +`openrc` and all `rc-*` tools provie a --user/-U flag to operate with user-mode +services and runlevels. + +The XDG_RUNTIME_DIR variable must be set before calling openrc --user, as it's +used to store state for openrc itself and the services it runs.