You are not logged in.
Pages: 1
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
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
Doesn't work i'm afraid.
Offline
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
How does this qualify as a Community Contribution?
no place like /home
github
Offline
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.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
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
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
I got it working after modifying the line to this "su - median -c 'screen -d -m rtorrent' &> /dev/null".
Offline
Pages: 1