PDA

View Full Version : Make service unit for systemd which runs screen



SvenVD
21st August 2011, 08:49 PM
Hi,

I am running Fedora 15

I would like to make a service.unit for systemd that starts rtorrent(or any other interactive daemon) in a screen session for user sven at boot.

The following I've got so far


[Unit]
Description=Starts rtorrent in a screen environment for the user sven

[Service]
Type=oneshot
ExecStart=/bin/su -c "/usr/bin/screen -A -d -m -S rtorrent /usr/bin/rtorrent" sven

[Install]
WantedBy=multi-user.target


systemctl enable rtorrentsven.service
ln -s '/lib/systemd/system/rtorrentsven.service' '/etc/systemd/system/multi-user.target.wants/rtorrentsven.service'

However it is not working as expected:

The service is not started at boot
if I start the service manually (systemctl start), then the screen is running and working as expected, but ..


In both cases status is showing

systemctl status rtorrentsven.service
rtorrentsven.service - Starts rtorrent in a screen environment for the user sven
Loaded: loaded (/lib/systemd/system/rtorrentsven.service)
Active: inactive (dead) since Sun, 21 Aug 2011 21:44:41 +0200; 2min 11s ago
Main PID: 684 (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/rtorrentsven.service

inactive/dead

Please advise

Thanks!