Run rtorrent as a daemon in Arch Linux
Copy this into /etc/rc.d/rtorrent and add the daemon to /etc/rc.conf. Make sure you change USER in the script below to your user name
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting rtorrent"
su rtorrent -c 'screen -d -m 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
Source:
http://forums.gentoo.org/viewtopic-t-600362.html
http://wiki.archlinux.org/index.php/RTorrent#rtorrent_Daemon_with_screen
