net-p2p/rtorrent-0.8.4 pulls in app-misc/screen if USE="daemon" is set. As rtorrent doesnt have any "daemon mode", screen is used to daemonize it. dtach, with detaching as its only funtionality(and its 55 kB vs. screens 831 kB source size) would be a more appropriate alternative. IMHO, a simple, $ dtach -A /tmp/dtach-rtorrent.socket /usr/bin/rtorrent and $ dtach -a /tmp/dtach-rtorrent.socket to attach is easier then fiddling around with screen. Reproducible: Always Steps to Reproduce:
I'm not familar with dtach. Please provide a diff of the init scripts that work for either screen or dtach and I will consider them. Keep in mind, the screen users will have the same complaints about dtach as you do for screen. As for why the screen implementation, upstream provided hints on that. http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#tkt-changes-hdr Thanks.
(In reply to comment #0) > IMHO, a simple, > $ dtach -A /tmp/dtach-rtorrent.socket /usr/bin/rtorrent > and > $ dtach -a /tmp/dtach-rtorrent.socket > to attach is easier then fiddling around with screen. btw, that is just an opinion. "screen -dr" is pretty easy too ;)
> btw, that is just an opinion. "screen -dr" is pretty easy too ;) Yeah, hence the _IMHO_, heh. The Gentoo Wiki rtorrent article talks about dtach, http://en.gentoo-wiki.com/wiki/Rtorrent
I'm going to mark this as "NeedPatch" I envision a conf.d file with some env var to specify if you want dtach or screen then carry on from there (either screen or dtach should work). ofc, that means that *both* apps will have to be dependencies...or some clever elog stating that dtach is an option. I would like to leave screen as the default. Personal choice..sorry. Patches welcome.
> Patches welcome. Very simple patch. See attachmests. 'screen' is default, but we can use 'dtach'.
Created attachment 182084 [details, diff] ebuild with || ( screen dtach ) dep
Created attachment 182086 [details] /etc/conf.d/rtorrentd with DAEMONIZER var
Created attachment 182087 [details] /etc/inint.d/rtorrentd can start 'screen' or 'dtach'
Comment on attachment 182084 [details, diff] ebuild with || ( screen dtach ) dep ><?xml version="1.0"?><html><head/><body><pre>--- /usr/portage/net-p2p/rtorrent/rtorrent-0.8.4-r1.ebuild 2009-02-13 01:06:59.000000000 +0300 >+++ /usr/local/portage/net-p2p/rtorrent/rtorrent-0.8.4-r1.ebuild 2009-02-15 06:03:44.000000000 +0300 >@@ -19,7 +19,7 @@ > sys-libs/ncurses > xmlrpc? ( dev-libs/xmlrpc-c )" > RDEPEND="${COMMON_DEPEND} >- daemon? ( app-misc/screen )" >+ daemon? ( || ( app-misc/screen app-misc/dtach ) )" > DEPEND="${COMMON_DEPEND} > dev-util/pkgconfig" ></pre></body></html>
I have set alias for fast reattaching rtorrent: alias rt="tput smkx;dtach -a /tmp/rtorrent.dtach -e "^T";tput rmkx" use 'rt' to attache and Ctrl+^T to detache it back
Hi! I mix the two versions (with app-misc/dtach and with app-misc/screen) into one ebuild. I also corrected a few bugs and added some features. Here is a list of changes: 1) USE-flag "daemon" is replaced by 2 flags: "screen" and "dtach". Now the user can select which program to use. The previous solution using the variable "DAEMONIZER" allows to switch between app-misc/screen and app-misc/dtach while the dependence || (app-misc/screen app-misc/dtach) does not guarantee that both are installed. 2) Considering the bug # 241172, I rewrote the line with start-stop-daemon call and found that when TERM=xterm the arrow keys do not work after attaching to the rtorrent. I encountered this when using app-misc/dtach, but I think that with app-misc/screen will be the same problem. So, I replaced the "xterm" to "linux", which solved the problem for me. Now value of variable TERM may be configured. 3) Since termination of rtorrent can take a long time, I added a delay between sending messages SIGINT and SIGKILL. This can be configured in configuration file. 4) I also added to the version with app-misc/dtach a simple script "rtorrent-atach", which allows to connect to rtorrent in one command. It also changed the way disconnection - used a combination of C-q, which excludes the possibility of inadvertent termination of the program. 5) Some other minor fixes - see attached files.
Created attachment 182826 [details, diff] diff between my version and the one in portage
Created attachment 182828 [details] init script for version with dtach
Created attachment 182830 [details] init script for version with screen
Created attachment 182832 [details] conf file for version with dtach
Created attachment 182833 [details] conf file for version with screen
Created attachment 182835 [details] script that simplify using version with dtach
Considering that start-stop-daemon will fail if the program is already running, IMHO, it would be better to encapsulate the dtach or screen call in a new executable, such as /usr/bin/rtorrentd, so that the user can be running dtach or screen, and still start rtorrentd. Unless I am mistaken, and you can change this behavior in start-stop-daemon.
(In reply to comment #18) > Considering that start-stop-daemon will fail if the program is already running, > IMHO, it would be better to encapsulate the dtach or screen call in a new > executable, such as /usr/bin/rtorrentd, so that the user can be running dtach > or screen, and still start rtorrentd. Unless I am mistaken, and you can change > this behavior in start-stop-daemon. > I ran into this issue with the screen method, as I always start a screen session when I log in. start-stop-daemon noticed my screen was already running and wouldn't start. This doesn't cause a problem at boot since you aren't logged in when it starts, but would if you restarted it. This is what I changed in the init.d: (changing the --exec to a --startas and adding a new --exec that is rtorrent) --exec /usr/bin/rtorrent \ --startas /usr/bin/dtach -- -n /tmp/rtorrentd.sock /usr/bin/rtorrent Oh, and this includes my dtach method. -n creates a new socked and starts it detached, which was the other issue I ran into.
Created attachment 261363 [details] rtorrent-0.8.6-r2.tar.gz I got tired of dealing with screen and running the current version of rtorrent as root so I updated what you guys did and created an ebuild that does a better job of running as a daemon by using app-misc/dtach.
IMHO, the proposed patches are way out of sync with the .init and .conf files for Screen. The patches don't even work (anymore) with a current installation. The Screen .init file is very basic. I think that's fine. We can all add our fun stuff and customizations later, and bring the good tips to the Gentoo rTorrent wiki [ http://wiki.gentoo.org/wiki/RTorrent ].
Created attachment 365814 [details, diff] proposed patch All what's needed for using dtach.
As rtorrent supports daemon mode from 0.9.7, I think it'd be better to just make the ebuild use that rather than add support for dtach. It's not implemented in the ebuild yet due to some bugs, but could be in the future.
its native daemon mode seems the way to go instead of dtach