I just finished the install and setup process of systemd on my arch-linux system (2012.09.07). I uninstalled
initscripts (and removed the configuration files).
What I want to do is create a service that can be started and stopped by a non-root user. The service is to start a detached screen session running rtorrent. However I want every user on the system who has set this service to start (enabled) to have a particular instance started for them specifically. How would one go about doing this?
I remember reading that systemd supports user instances of services, however I have been unable to find any information on how to set this up, or whether it relates to what I am looking for.
Service file that I have used for system:
[Unit] Description=rTorrent [Service] Type=forking ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
After reading through the man pages here and here, I understand how systemd works a bit better. Specifically that using the
WorkingDirectory= options allow for the service to be started in a user's session. However the issue still remains that the user themselves can not
disable the service. An Access is denied error is given by
First off, for simplification and for better use of systemd's user session (still somewhat incomplete) feature, I used sofar's user-session-units and followed his config advice.
It seems that there is a bug in the current version of DBus (1.6.4-1) in which it does not set the environment variable
DBUS_SESSION_BUS_ADDRESS meaning using the
systemctl --user command errors out with:
Failed to get D-Bus connection: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
The variable should look like this:
where USERUID needs to be the UID of the given user.