<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Running rtorrent as a daemon</title>
	<atom:link href="http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/feed/" rel="self" type="application/rss+xml" />
	<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/</link>
	<description>K.Mandla's blog of Linux experiences</description>
	<lastBuildDate>Mon, 11 Feb 2013 18:19:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: partimers</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-42312</link>
		<dc:creator><![CDATA[partimers]]></dc:creator>
		<pubDate>Tue, 16 Mar 2010 22:19:56 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-42312</guid>
		<description><![CDATA[Is it possible to have a daemon script to start rtorrent for multiple users? I am planning to migrate my tflux-b4rt seedbox (shared with other 6 friends of mine) to rutorrent. It is a Debian box, and I would like to have rtorrent running on daemon mode, starting one session per user.]]></description>
		<content:encoded><![CDATA[<p>Is it possible to have a daemon script to start rtorrent for multiple users? I am planning to migrate my tflux-b4rt seedbox (shared with other 6 friends of mine) to rutorrent. It is a Debian box, and I would like to have rtorrent running on daemon mode, starting one session per user.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K.Mandla</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40381</link>
		<dc:creator><![CDATA[K.Mandla]]></dc:creator>
		<pubDate>Thu, 10 Sep 2009 22:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40381</guid>
		<description><![CDATA[I put sourcecode tags on your script, in the hopes that Wordpress.com doesn&#039;t mangle the code. Cheers and thanks. ;)]]></description>
		<content:encoded><![CDATA[<p>I put sourcecode tags on your script, in the hopes that WordPress.com doesn&#8217;t mangle the code. Cheers and thanks. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lindylex</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40380</link>
		<dc:creator><![CDATA[lindylex]]></dc:creator>
		<pubDate>Thu, 10 Sep 2009 21:16:30 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40380</guid>
		<description><![CDATA[A little more instruction for the beginners.

1. Go to the commandline
2. aptitude update
3. aptitude install tofrodos nano
4. Log in as root or use su and continue with 4. Alternative minus using the su in front of each command.
     su [ Enter root password ]
4. Alternative using su
    su nano /etc/init.d/rtorentdaemon

   This will open the text editor nano if installed to create and edit this file /etc/init.d/rtorentdaemon

Place the contents from above into the file and edit these lines to match the user you plan to run rtorrent as.

user=”usernamerunningrtorrent”

config=”/home/usernamerunningrtorrent/.rtorrent.rc”

base=”/home/usernamerunningrtorrent”

An example of this file &quot;config=”/home/usernamerunningrtorrent/.rtorrent.rc”&quot;  can be retrieved here.

http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?rev=latest

Copy it from the website into a Linux editor and save.  Don&#039;t download directly since it was create with Windows it will bomb with lines break issues.  You can use the dos2unix command to convert it if you download the file directly like this.

dos2unix /home/usernamerunningrtorrent/.rtorrent.rc]]></description>
		<content:encoded><![CDATA[<p>A little more instruction for the beginners.</p>
<p>1. Go to the commandline<br />
2. aptitude update<br />
3. aptitude install tofrodos nano<br />
4. Log in as root or use su and continue with 4. Alternative minus using the su in front of each command.<br />
     su [ Enter root password ]<br />
4. Alternative using su<br />
    su nano /etc/init.d/rtorentdaemon</p>
<p>   This will open the text editor nano if installed to create and edit this file /etc/init.d/rtorentdaemon</p>
<p>Place the contents from above into the file and edit these lines to match the user you plan to run rtorrent as.</p>
<p>user=”usernamerunningrtorrent”</p>
<p>config=”/home/usernamerunningrtorrent/.rtorrent.rc”</p>
<p>base=”/home/usernamerunningrtorrent”</p>
<p>An example of this file &#8220;config=”/home/usernamerunningrtorrent/.rtorrent.rc”&#8221;  can be retrieved here.</p>
<p><a href="http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?rev=latest" rel="nofollow">http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?rev=latest</a></p>
<p>Copy it from the website into a Linux editor and save.  Don&#8217;t download directly since it was create with Windows it will bomb with lines break issues.  You can use the dos2unix command to convert it if you download the file directly like this.</p>
<p>dos2unix /home/usernamerunningrtorrent/.rtorrent.rc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lindylex</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40379</link>
		<dc:creator><![CDATA[lindylex]]></dc:creator>
		<pubDate>Thu, 10 Sep 2009 20:57:42 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-40379</guid>
		<description><![CDATA[Use this for running rtorrent as a daemon with Debian.

[sourcecode language=&quot;xml&quot;]#!/bin/bash

### BEGIN INIT INFO

# Provides:       rtorrent

# Required-Start:  $network 

# Required-Stop:   $network 

# Default-Start:   2 3 4 5

# Default-Stop:    0 1 6

# Short-Description: Start rtorrent as a daemon

### END INIT INFO

#!/bin/sh

#############

######

#############

# This script depends on screen.

# For the stop function to work, you must set an

# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.

# If you typically just start rtorrent with just &quot;rtorrent&quot; on the

# command line, all you need to change is the &quot;user&quot; option.

# Attach to the screen session as your user with 

# &quot;screen -dr rtorrent&quot;. Change &quot;rtorrent&quot; with srnname option.

# Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com

##############

######

##############

#######################

##Start Configuration##

#######################

# You can specify your configuration in a different file 

# (so that it is saved with upgrades, saved in your home directory,

# or whateve reason you want to)

# by commenting out/deleting the configuration lines and placing them

# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would

# have written them here (you can leave the comments if you desire

# and then uncommenting the following line correcting the path/filename 

# for the one you used. note the space after the &quot;.&quot;.

# . /etc/rtorrent.init.conf

#Do not put a space on either side of the equal signs e.g.

# user = user 

# will not work

# system user to run as

user=&quot;usernamerunningrtorrent&quot;

# the system group to run as, not implemented, see d_start for beginning implementation

# group=`id -ng &quot;$user&quot;`

# the full path to the filename where you store your rtorrent configuration

config=&quot;/home/usernamerunningrtorrent/.rtorrent.rc&quot;

# set of options to run with

options=&quot;&quot;

# default directory for screen, needs to be an absolute path

#base=&quot;/home/${user}&quot;

base=&quot;/home/usernamerunningrtorrent&quot;

# name of screen session

srnname=&quot;rtorrent&quot;

# file to log to (makes for easier debugging if something goes wrong)

logfile=&quot;/var/log/rtorrentInit.log&quot;

#######################

###END CONFIGURATION###

#######################

PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin

DESC=&quot;rtorrent&quot;

NAME=rtorrent

DAEMON=$NAME

SCRIPTNAME=/etc/init.d/$NAME

checkcnfg() {

	exists=0

	for i in `echo &quot;$PATH&quot; &#124; tr &#039;:&#039; &#039;\n&#039;` ; do

		if [ -f $i/$NAME ] ; then

			exists=1

			break

		fi

	done

	if [ $exists -eq 0 ] ; then

		echo &quot;cannot find rtorrent binary in PATH $PATH&quot; &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

		exit 3

	fi

	if ! [ -r &quot;${config}&quot; ] ; then 

		echo &quot;cannot find readable config ${config}. check that it is there and permissions are appropriate&quot; &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

		exit 3 

	fi 

	session=`getsession &quot;$config&quot;` 

	if ! [ -d &quot;${session}&quot; ] ; then

		echo &quot;cannot find readable session directory ${session} from config ${config}. check permissions&quot; &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

		exit 3

	fi

}

d_start() {

  [ -d &quot;${base}&quot; ] &amp;&amp; cd &quot;${base}&quot;

  stty stop undef &amp;&amp; stty start undef

  su -c &quot;screen -ls &#124; grep -sq &quot;\.${srnname}[[:space:]]&quot; &quot; ${user} &#124;&#124; su -c &quot;screen -dm -S ${srnname} 2&gt;&amp;1 1&gt;/dev/null&quot; ${user} &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

  # this works for the screen command, but starting rtorrent below adopts screen session gid

  # even if it is not the screen session we started (e.g. running under an undesirable gid

  #su -c &quot;screen -ls &#124; grep -sq &quot;\.${srnname}[[:space:]]&quot; &quot; ${user} &#124;&#124; su -c &quot;sg \&quot;$group\&quot; -c \&quot;screen -fn -dm -S ${srnname} 2&gt;&amp;1 1&gt;/dev/null\&quot;&quot; ${user} &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

  su -c &quot;screen -S &quot;${srnname}&quot; -X screen rtorrent ${options} 2&gt;&amp;1 1&gt;/dev/null&quot; ${user} &#124; tee -a &quot;$logfile&quot; &gt;&amp;2

}

d_stop() {

	session=`getsession &quot;$config&quot;`

	if ! [ -s ${session}/rtorrent.lock ] ; then

		return

	fi

	pid=`cat ${session}/rtorrent.lock &#124; awk -F: &#039;{print($2)}&#039; &#124; sed &quot;s/[^0-9]//g&quot;`

	if ps -A &#124; grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn&#039;t belong to another process

		kill -s INT ${pid}

	fi

}

getsession() { 

	session=`awk &#039;/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}&#039; &quot;$config&quot;`

	echo $session

}

checkcnfg

case &quot;$1&quot; in

  start)

	echo -n &quot;Starting $DESC: $NAME&quot;

	d_start

	echo &quot;.&quot;

	;;

  stop)

	echo -n &quot;Stopping $DESC: $NAME&quot;

	d_stop

	echo &quot;.&quot;

	;;

  restart&#124;force-reload)

	echo -n &quot;Restarting $DESC: $NAME&quot;

	d_stop

	sleep 1

	d_start

	echo &quot;.&quot;

	;;

  *)

	echo &quot;Usage: $SCRIPTNAME {start&#124;stop&#124;restart&#124;force-reload}&quot; &gt;&amp;2

	exit 1

	;;

esac

exit 0[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Use this for running rtorrent as a daemon with Debian.</p>
<pre class="brush: xml; title: ; notranslate">#!/bin/bash

### BEGIN INIT INFO

# Provides:       rtorrent

# Required-Start:  $network 

# Required-Stop:   $network 

# Default-Start:   2 3 4 5

# Default-Stop:    0 1 6

# Short-Description: Start rtorrent as a daemon

### END INIT INFO

#!/bin/sh

#############

######

#############

# This script depends on screen.

# For the stop function to work, you must set an

# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.

# If you typically just start rtorrent with just "rtorrent" on the

# command line, all you need to change is the "user" option.

# Attach to the screen session as your user with 

# "screen -dr rtorrent". Change "rtorrent" with srnname option.

# Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com

##############

######

##############

#######################

##Start Configuration##

#######################

# You can specify your configuration in a different file 

# (so that it is saved with upgrades, saved in your home directory,

# or whateve reason you want to)

# by commenting out/deleting the configuration lines and placing them

# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would

# have written them here (you can leave the comments if you desire

# and then uncommenting the following line correcting the path/filename 

# for the one you used. note the space after the ".".

# . /etc/rtorrent.init.conf

#Do not put a space on either side of the equal signs e.g.

# user = user 

# will not work

# system user to run as

user="usernamerunningrtorrent"

# the system group to run as, not implemented, see d_start for beginning implementation

# group=`id -ng "$user"`

# the full path to the filename where you store your rtorrent configuration

config="/home/usernamerunningrtorrent/.rtorrent.rc"

# set of options to run with

options=""

# default directory for screen, needs to be an absolute path

#base="/home/${user}"

base="/home/usernamerunningrtorrent"

# name of screen session

srnname="rtorrent"

# file to log to (makes for easier debugging if something goes wrong)

logfile="/var/log/rtorrentInit.log"

#######################

###END CONFIGURATION###

#######################

PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin

DESC="rtorrent"

NAME=rtorrent

DAEMON=$NAME

SCRIPTNAME=/etc/init.d/$NAME

checkcnfg() {

	exists=0

	for i in `echo "$PATH" | tr ':' '\n'` ; do

		if [ -f $i/$NAME ] ; then

			exists=1

			break

		fi

	done

	if [ $exists -eq 0 ] ; then

		echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" &gt;&amp;2

		exit 3

	fi

	if ! [ -r "${config}" ] ; then 

		echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" &gt;&amp;2

		exit 3 

	fi 

	session=`getsession "$config"` 

	if ! [ -d "${session}" ] ; then

		echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" &gt;&amp;2

		exit 3

	fi

}

d_start() {

  [ -d "${base}" ] &amp;&amp; cd "${base}"

  stty stop undef &amp;&amp; stty start undef

  su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "screen -dm -S ${srnname} 2&gt;&amp;1 1&gt;/dev/null" ${user} | tee -a "$logfile" &gt;&amp;2

  # this works for the screen command, but starting rtorrent below adopts screen session gid

  # even if it is not the screen session we started (e.g. running under an undesirable gid

  #su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"screen -fn -dm -S ${srnname} 2&gt;&amp;1 1&gt;/dev/null\"" ${user} | tee -a "$logfile" &gt;&amp;2

  su -c "screen -S "${srnname}" -X screen rtorrent ${options} 2&gt;&amp;1 1&gt;/dev/null" ${user} | tee -a "$logfile" &gt;&amp;2

}

d_stop() {

	session=`getsession "$config"`

	if ! [ -s ${session}/rtorrent.lock ] ; then

		return

	fi

	pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`

	if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process

		kill -s INT ${pid}

	fi

}

getsession() { 

	session=`awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "$config"`

	echo $session

}

checkcnfg

case "$1" in

  start)

	echo -n "Starting $DESC: $NAME"

	d_start

	echo "."

	;;

  stop)

	echo -n "Stopping $DESC: $NAME"

	d_stop

	echo "."

	;;

  restart|force-reload)

	echo -n "Restarting $DESC: $NAME"

	d_stop

	sleep 1

	d_start

	echo "."

	;;

  *)

	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" &gt;&amp;2

	exit 1

	;;

esac

exit 0</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: delt</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39814</link>
		<dc:creator><![CDATA[delt]]></dc:creator>
		<pubDate>Sun, 12 Jul 2009 01:50:01 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39814</guid>
		<description><![CDATA[I just have rtorrent running in a screen session. Works great =)]]></description>
		<content:encoded><![CDATA[<p>I just have rtorrent running in a screen session. Works great =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karthik</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39470</link>
		<dc:creator><![CDATA[karthik]]></dc:creator>
		<pubDate>Thu, 28 May 2009 21:20:39 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39470</guid>
		<description><![CDATA[I&#039;ve been running rtorrent in a detatched screen session for ages now- but I often forget to quit rtorrent before powering off the PC. On the next restart, rtorrent forces a hash check that slows down all activity and locks up the PC. 

Thanks to this guide, I&#039;m one step closer to fire and forget. Thanks!]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve been running rtorrent in a detatched screen session for ages now- but I often forget to quit rtorrent before powering off the PC. On the next restart, rtorrent forces a hash check that slows down all activity and locks up the PC. </p>
<p>Thanks to this guide, I&#8217;m one step closer to fire and forget. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gfg</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39461</link>
		<dc:creator><![CDATA[gfg]]></dc:creator>
		<pubDate>Thu, 28 May 2009 11:14:47 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39461</guid>
		<description><![CDATA[Why don&#039;t you use transmission-daemon? it has a nice web gui, and you can use it over ssh with transmission-client]]></description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you use transmission-daemon? it has a nice web gui, and you can use it over ssh with transmission-client</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fuxter</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39459</link>
		<dc:creator><![CDATA[fuxter]]></dc:creator>
		<pubDate>Wed, 27 May 2009 22:49:18 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39459</guid>
		<description><![CDATA[i was surprised to see that installation of rtorrent for ubuntu does not come with /etc/init.d/rtorrent by default!
i just got used to http://oleg.wl500g.info/ oleg&#039;s custom firmware (wich is linux of course) for my router. when i installed rtorrent for the router i came with /etc/init.d/rtorrent and /etc/rtorrent.conf. all i had to do is create a new user &quot;p2p&quot; and configure directories and some settings to my likes.
so for my ubuntu i just mimicked the same behavior.
oh, and there&#039;s special alias &quot;rt&quot; that sues to p2p user and screens -r the rtorrent session. and that&#039;s the best part. but it come a bit annoying when you connect to remote rtorrent session being in screen yourself. always knocks me off my local screen when i wanted to detach remote one. ^a+a saves the day though.]]></description>
		<content:encoded><![CDATA[<p>i was surprised to see that installation of rtorrent for ubuntu does not come with /etc/init.d/rtorrent by default!<br />
i just got used to <a href="http://oleg.wl500g.info/" rel="nofollow">http://oleg.wl500g.info/</a> oleg&#8217;s custom firmware (wich is linux of course) for my router. when i installed rtorrent for the router i came with /etc/init.d/rtorrent and /etc/rtorrent.conf. all i had to do is create a new user &#8220;p2p&#8221; and configure directories and some settings to my likes.<br />
so for my ubuntu i just mimicked the same behavior.<br />
oh, and there&#8217;s special alias &#8220;rt&#8221; that sues to p2p user and screens -r the rtorrent session. and that&#8217;s the best part. but it come a bit annoying when you connect to remote rtorrent session being in screen yourself. always knocks me off my local screen when i wanted to detach remote one. ^a+a saves the day though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39458</link>
		<dc:creator><![CDATA[Greg]]></dc:creator>
		<pubDate>Wed, 27 May 2009 21:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://kmandla.wordpress.com/2009/05/28/running-rtorrent-as-a-daemon/#comment-39458</guid>
		<description><![CDATA[Btpd http://aur.archlinux.org/packages.php?ID=8049 is a decent client that includes a daemon.
Its more suitable for &quot;lightweight&quot; torrent users as its CLI only and not ncurses like rtorrent.]]></description>
		<content:encoded><![CDATA[<p>Btpd <a href="http://aur.archlinux.org/packages.php?ID=8049" rel="nofollow">http://aur.archlinux.org/packages.php?ID=8049</a> is a decent client that includes a daemon.<br />
Its more suitable for &#8220;lightweight&#8221; torrent users as its CLI only and not ncurses like rtorrent.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
