Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Strange Systemd Problem

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
scouseman
Posts: 13
Joined: 2016-10-07 22:34

Strange Systemd Problem

#1 Post by scouseman »

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

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

#2 Post by debiman »

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?

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

Re: Strange Systemd Problem

#3 Post by scouseman »

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.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: Strange Systemd Problem

#4 Post by dilberts_left_nut »

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...

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

Re: Strange Systemd Problem

#5 Post by scouseman »

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

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

#6 Post by debiman »

i raised three points in my previous post, of which you addressed one so far.
so, still waiting.

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

Re: Strange Systemd Problem

#7 Post by scouseman »

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

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Strange Systemd Problem

#8 Post by debiman »

compare what you have to what you see here, a few things are different, and there's alternatives you can try.

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

Re: Strange Systemd Problem

#9 Post by scouseman »

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

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Strange Systemd Problem

#10 Post by Head_on_a_Stick »

scouseman wrote:still wont work as user - scouseman
https://wiki.archlinux.org/index.php/Systemd/User

Oh and big up the Wallasey Massive! :mrgreen:
deadbang

Post Reply