You are not logged in.

#1 2011-06-17 11:19:05

Median
Member
Registered: 2011-06-03
Posts: 60

rtorrent daemon doesn't work on boot

Hello. I'm having a problem with the screen daemon for rtorrent, i've put it in /etc/rc.d/rtorrent and starting it manually works fine through "sudo /etc/rc.d/rtorrent start" but when i add it in the daemons array in rc.conf to start it on boot it says "Done" but when i log in to my account and i try to restore the rtorrent screen there's no screen available and i need to start a screen manually and open rtorrent in it.

This is the script that i'm using

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    stat_busy "Starting rtorrent"
    su median -c 'screen -d -m -S rtorrent rtorrent' &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon rtorrent
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping rtorrent"
    killall -w -s 2 /usr/bin/rtorrent &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon rtorrent
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Offline

#2 2011-06-17 11:28:49

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,923
Website

Re: rtorrent daemon doesn't work on boot

Put this to the beginning of your script:

source /etc/profile

Last edited by SanskritFritz (2011-06-17 11:30:46)


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#3 2011-06-17 12:05:48

Median
Member
Registered: 2011-06-03
Posts: 60

Re: rtorrent daemon doesn't work on boot

Doesn't work i'm afraid.

Offline

#4 2011-06-17 13:15:34

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: rtorrent daemon doesn't work on boot

Median wrote:

starting it manually works fine through "sudo /etc/rc.d/rtorrent start"

- With 'works fine' do you mean you can access through screen?
- Does it actually run as user 'median' in both cases (check with 'ps aux | grep torrent' ) ?
- What if you do 'su -' and then start the daemon?
- Have you checked /var/log/daemon.log ?

Offline

#5 2011-06-17 14:39:25

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: rtorrent daemon doesn't work on boot

How does this qualify as a Community Contribution?


no place like /home
github

Offline

#6 2011-06-17 14:41:57

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: rtorrent daemon doesn't work on boot

demian wrote:

How does this qualify as a Community Contribution?

It doesn't. Next time please use the Report function to bring it to the attention of one of the mods.


Moving to Newbie Corner.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#7 2011-06-17 15:39:31

Median
Member
Registered: 2011-06-03
Posts: 60

Re: rtorrent daemon doesn't work on boot

rwd wrote:
Median wrote:

starting it manually works fine through "sudo /etc/rc.d/rtorrent start"

- With 'works fine' do you mean you can access through screen?
- Does it actually run as user 'median' in both cases (check with 'ps aux | grep torrent' ) ?
- What if you do 'su -' and then start the daemon?
- Have you checked /var/log/daemon.log ?

I just tried again, and and "sudo /etc/rc.d/rtorrent start" does not appear to work. When i type "screen -r" there's no screen to be attached. Even though it does say that it succeeded in starting the daemon. Neither does just "/etc/rc.d/rtorrent start", it just gets stuck on [Busy]. It seems like the daemon itself doesn't work.
Running "su -" and starting the daemon doesn't work, same as running it as root.
Nothing appears in /var/log/daemon.log

And i'm sorry about the thread placement.

Offline

#8 2011-06-17 15:49:40

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: rtorrent daemon doesn't work on boot

The usual thing to do when a daemon won't start is checking the error messages by  running the app manually as the user that the daemon should run under, possibly with some 'verbose' option to see more detail.  In this case the line in the script that starts it  up (minus the '&> /dev/null' part that redirects output):

su median -c 'screen -d -m -S rtorrent rtorrent'

Or to be sure the problem is not screen but rtorrent you just run 'rtorrent' as user median.

Last edited by rwd (2011-06-17 16:02:35)

Offline

#9 2011-06-17 16:36:33

Median
Member
Registered: 2011-06-03
Posts: 60

Re: rtorrent daemon doesn't work on boot

I got it working after modifying the line to this "su - median -c 'screen -d -m rtorrent' &> /dev/null".

Offline

Board footer

Powered by FluxBB