You are not logged in.
*edit* - oh damnit, wrong forum. Move please? - thanks jason
---
I've been trying to convert XMMS2's daemon to a systemd service file while still being able to use the current /etc/conf.d/xmms2d.conf.
The issue here is that xmms2's daemon needs to be run as the user and does not have a feature to drop to a user after starting (like mpd). So we must tell systemd to run this daemon as a certain user. Important to note is that is it not possible to pass a $VAR from EnvironmentFile to User=. We can pass $VAR to ExecStart=, which is what the second option relies on.
After some digging and hanging in #systemd, I've come up with 2 options:
1. using an instanced service.
/lib/systemd/system/xmms2d@.service
The service has to be started by doing systemctl start xmms2d@<username>.service.
<username> is then available in xmms2d.service as %I.
[Unit]
Description=XMMS2 daemon
After=sound.target
[Service]
Type=forking
User=%I
EnvironmentFile=/etc/conf.d/xmms2d.conf
ExecStart=/usr/bin/xmms2-launcher $XMMS2_PARAMETERS
ExecStop=/usr/bin/xmms2 quit
[Install]
WantedBy=multi-user.target
2. using /bin/su -c (aka "ugly terrible hack according to #systemd)
/lib/systemd/system/xmms2d.service
[Unit]
Description=XMMS2 daemon
After=sound.target
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/xmms2d.conf
ExecStart=/bin/su $XMMS2DUSER -l -c "/usr/bin/xmms2-launcher"
ExecStop=/usr/bin/xmms2 quit
[Install]
WantedBy=multi-user.target
So now the question: Am I doing this the right way?
With gnome 3.6 around the corner, I'm trying to learn how to use systemd properly. All comments welcome
Last edited by stefanwilkens (2012-10-06 00:42:52)
Arch i686 on Phenom X4 | GTX760
Offline
Multimedia here we come...
Offline
Multimedia here we come...
Thank you, jasonwryan, brain not working properly today.
Arch i686 on Phenom X4 | GTX760
Offline