You are not logged in.
Pages: 1
Hi all,
I create a custom systemd service file, to run rtorrent into screen, but not work. "journalctl" said "terminated" and/or "failed", but no detailed message. Here is the code:
[Unit]
Description=rtorrent Service
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/sudo -u raspi /usr/bin/screen -d -RR /usr/bin/rtorrent
[Install]
WantedBy=multi-user.target
I tried with "forking" type instead of "oneshot", but same result. Then I tried "User=raspi", but not work. (The user name and the path's is correct)
What's the problem?
I use this article.
Offline
does "screen -d -RR /usr/bin/bash -c /usr/bin/rtorrent" work?
Offline
Thanks, I will try it.
Offline
First, Type=oneshot is wrong. It will terminate all remaining processes after the initial process returns - you need Type=forking. Second, do not use sudo (or su) inside a systemd unit, there are User= and Group= switches.
Finally, you are trying to launch a screen session, which requires a tty - which systemd does not give you. You must launch a detached screen session using
ExecStart=/usr/bin/screen -S rtorrent -dm /usr/bin/rtorrent
Reading the screen manpage, it might even be useful to not fork when using systemd: Remove the Type= statement and use
ExecStart=/usr/bin/screen -S rtorrent -Dm /usr/bin/rtorrent
Offline
tested.
$ edit rtorrent@.server
[Unit]
Description=rtorrent Service
After=network.target
[Service]
Type=forking
User=%i
ExecStart=/usr/bin/screen -dmS rtorrent rtorrent
ExecStop=/usr/bin/screen -S rtorrent -X quit
[Install]
WantedBy=multi-user.target
$ systemctl start rtorrent@user
Linux, Vim, Ruby, Javascript and Go.
Offline
Pages: 1