how to: rtorrent con screen e ssh
Link:
- http://wiki.archlinux.org/index.php/Rtorrent
- http://stabellini.net/rtorrent-howto.txt
- http://wiki.archlinux.org/index.php/SSH (dovete avere SSH funzionante)
- Configurazione host remoto:
-
yaourt -S rtorrent screen
-
cp /etc/screenrc ~/.screenrc
-
nano .screenrc ..... ..... screen -t rtorrent rtorrent # rtorrent always start with screen
-
nano .rtorrent.rc : scgi_port = 127.0.0.1:5000 # socket port for ntorrent (a gui for rtorrent
)
# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
max_peers = 250
# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
max_peers_seed = 250
# Maximum number of simultanious uploads per torrent.
#max_uploads = 8
# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 10
# Default directory to save the downloaded torrents.
directory = /media/banca_dati/torrent
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /media/banca_dati/torrent/in_download_torrent
# Watch a directory for new torrents, and stop those that have been
# deleted.
#schedule = watch_directory,5,5,load_start=./watch/*.torrent
#schedule = untied_directory,5,5,stop_untied=
schedule = watch_directory,10,10,load_start=/media/banca_dati/watch_torrent/*.torrent
schedule = untied_directory,5,5,"remove_untied="
#schedule = tied_directory,5,5,start_tied=
schedule = low_diskspace,60,60,"close_low_diskspace=100M"
# Port range to use for listening.
port_range = 17594-17594
# Start opening ports at a random position within the port range.
#port_random = no
# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
check_hash = yes
# Set whetever the client should try to connect to UDP trackers.
#use_udp_trackers = yes
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
#encryption = allow_incoming,enable_retry,prefer_plaintext
encryption = allow_incoming,try_outgoing,enable_retry
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
# dht = auto
# UDP port to use for DHT.
#
# dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
# peer_exchange = yes
#
# Do not modify the following parameters unless you know what you're doing.
#
# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
#hash_read_ahead = 10
# Interval between attempts to check the hash, in milliseconds.
#hash_interval = 100
# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
#hash_max_tries = 10
on_finished = rm_torrent,"execute=rm,$d.get_tied_to_file="
on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/media/banca_dati/torrent/Completati/ ;d.set_directory=/media/banca_dati/rtorrent/Completati/"
-
nano /etc/rc.d/rtorrent : #!/bin/bash . /etc/rc.conf . /etc/rc.d/functions case "$1" in start) stat_busy "Starting rtorrent" su <utente linux> -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
-
- Avvio:
- Host remoto (tramite ssh):
-
nano rtorrentqueuemanager.py : #!/usr/bin/env python import glob import stat import os import shutil import time #change the parametes watch = "/media/banca_dati/watch_torrent" session = "/media/banca_dati/torrent/in_download_torrent" queue = "/media/banca_dati/torrent/coda_torrent" max_downloads = 2 while True: time.sleep(60) sfiles = glob.glob(session + "/*.torrent") oldesttime = 0 oldestfile = "" if len(sfiles) < max_downloads : qfiles = glob.glob(queue + "/*.torrent") for i in qfiles : ftime = os.stat(i)[stat.ST_MTIME] if oldesttime == 0 or ftime < oldesttime : oldesttime = ftime oldestfile = i if oldestfile != "" : shutil.move(oldestfile, watch) -
sudo /etc/rc.d/rtorrent start
-
sudo python rtorrentqueuemanager.py &
-
- host locale:
-
echo "ssh -p <porta> -t <utente>@<IP> 'screen -r'" > rtorrent_connetti.sh
-
nano .bashrc : ..... # control+s con screen e rtorrent: # http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide#Addingandremovingtorrents # stty stop undef stty start undef ..... .....
-
bash rtorrent_connetti.sh
-
# a java gui for rtorrent: yaourt -S ntorrent
-
- Host remoto (tramite ssh):
Last update: 06 mar 2010


ciao, ti devo ringraziare. finalmente riesco a lanciare $foo su screen. eppure il man l’ho seguito più volte, google pure.
senti un pò perchè screen -t $foo $foo? perchè due volte?
ho guardato sul man, -t è la flag per il titolo della shell, quindi li con quel comando imposti prima come titolo $foo e poi gli fai eseguire “$foo”
ciao
anche se a me non imposta il titolo! L’ho notato solo adesso.. quindi l’ho tolta