Strange Systemd Problem

If none of the more specific forums is the right place to ask

Strange Systemd Problem

Postby scouseman » 2018-03-21 23:10

Hi I wonder if somebody could possibly help me with this systemd problem I have been pulling my hair out trying to resolve it.
Here is my systemd file rtorrent.service
Code: Select all
[Unit]
Description=rTorrent
After=network.target

[Service]
UMask=077
Type=forking
KillMode=none
User=scouseman
ExecStartPre=-/bin/rm -f /home/scouseman/downloads/session/rtorrent.lock
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/local/bin/rtorrent
WorkingDirectory=/home/scouseman/downloads/

[Install]
WantedBy=multi-user.target


I have run
Code: Select all
sudo systemctl enable rtorrent
sudo systemctl daemon-reload
sudo systemctl start rtorrent
sudo systemctl status rtorrent


which gives me an output:
● rtorrent.service - rTorrent
Loaded: loaded (/etc/systemd/system/rtorrent.service; enabled)
Active: active (running) since Wed 2018-03-21 23:31:19 GMT; 23min ago
Main PID: 971 (screen)
CGroup: /system.slice/rtorrent.service
├─971 /usr/bin/SCREEN -d -m -fa -S rtorrent /usr/local/bin/rtorrent
└─979 /usr/local/bin/rtorrent

Mar 21 23:54:53 Openmediavault systemd[1]: Started rTorrent.


But the service is still not running :(

If I run the start line out of the systemd file at the command prompt it works
Code: Select all
/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent


But for the life of me I cannot it get it to autostart on bootup.
There are also no errors in the systemd log.

Anyone any ideas what I have done wrong?

Cheers
scouseman
 
Posts: 13
Joined: 2016-10-07 22:34

Re: Strange Systemd Problem

Postby debiman » 2018-03-22 06:01

may i ask why rtorrent needs to be started inside a screen session and what that line does in detail?
are you sure it would work like that from within a systemd service? remember, there's no environment.

about all those "extra" lines:
have you tried creating a simpler service file first, and get that to work?
User avatar
debiman
 
Posts: 3064
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

Postby scouseman » 2018-03-22 07:25

Hi, Thanks for your reply:

the flags are
-S rtorrent Screen session name: rtorrent
-d -m Start screen in detached mode; exit if session terminates
-fa Flow control: automatic


I forgot to mention am trying to run this on jessie.
scouseman
 
Posts: 13
Joined: 2016-10-07 22:34

Re: Strange Systemd Problem

Postby dilberts_left_nut » 2018-03-22 08:10

scouseman wrote:But the service is still not running

What makes you think that?
This says it is...
scouseman wrote:
Code: Select all
Loaded: loaded (/etc/systemd/system/rtorrent.service; enabled)
Active: active (running) since Wed 2018-03-21 23:31:19 GMT; 23min ago
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4913
Joined: 2009-10-05 07:54
Location: enzed

Re: Strange Systemd Problem

Postby scouseman » 2018-03-22 13:06

Hi, thanks for your reply.
I am unable to access the service via the web browser, after I run
Code: Select all
/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent

on the command line I am able to.
All seems very strange to me.
Cheers
scouseman
 
Posts: 13
Joined: 2016-10-07 22:34

Re: Strange Systemd Problem

Postby debiman » 2018-03-22 16:57

i raised three points in my previous post, of which you addressed one so far.
so, still waiting.
User avatar
debiman
 
Posts: 3064
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

Postby scouseman » 2018-03-22 17:24

Sorry about that.

are you sure it would work like that from within a systemd service?


I assume it should work ok,

have you tried creating a simpler service file first, and get that to work?


the problem I have is that I dont know which lines are causing it not it works.
I have tried taking out ExecStartPre line & ExecStop but that makes no difference.

Cheers
scouseman
 
Posts: 13
Joined: 2016-10-07 22:34

Re: Strange Systemd Problem

Postby debiman » 2018-03-22 17:43

compare what you have to what you see here, a few things are different, and there's alternatives you can try.
User avatar
debiman
 
Posts: 3064
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

Postby scouseman » 2018-03-22 19:39

Yes I found that site on my google searches yesterday, didnt really, but thanks anyway for your help and effort.

I am a bit closer to resolving this now, but still have one serious issue though, I have managed to get it to work as user root (I can only imagine how that is) but still wont work as user - scouseman.
I have checked the permissions on the session folder, but there is no program folder.

How I got managed to get it to work on root was by naming the systemd file as
Code: Select all
rtorrent@.services
sudo systemctl enable rtorrent@8081
sudo systemctl daemon-reload
sudo systemctl start rtorrent@8081


using the same code for the systemd file except user = root :(
and that works after reboot



Cheers
scouseman
 
Posts: 13
Joined: 2016-10-07 22:34

Re: Strange Systemd Problem

Postby Head_on_a_Stick » 2018-03-22 21:04

scouseman wrote:still wont work as user - scouseman

https://wiki.archlinux.org/index.php/Systemd/User

Oh and big up the Wallasey Massive! :mrgreen:
dbruce wrote:Ubuntu forums try to be like a coffee shop in Seattle. Debian forums strive for the charm and ambience of a skinhead bar in Bacau. We intend to keep it that way.
User avatar
Head_on_a_Stick
 
Posts: 8324
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable