2017-11-24 06:56:34 UTC
More questions about the systemd user service.
Inside a script running as root, I want to control another user's service.
I have found two ways to do this:
systemd-run -t --setenv=XDG_RUNTIME_DIR=/run/user/<uid> --uid=<uid>
systemctl --user ...
su -l <username> -c "XDG_RUNTIME_DIR=/run/user/<uid> systemctl --user
If there a better way to do this?
My distros aren't recent enough to include "machinectl shell" but is that
the recommended way now?
machinectl --uid=<uid> shell /bin/systemctl --user ...
Perhaps there is not enough demand to justify it, but I would love if the
systemctl command itself had a way to specify that it should communicate
with a different user's service rather than system service or the calling
user's service. Something like:
systemctl --uid=<uid> --user ..
would be awesome.