Keresés

Hirdetés

Új hozzászólás Aktív témák

  • Bocsek

    aktív tag

    válasz ecaddict #3694 üzenetére

    Nekem is az a bajom, hogy az init.d-ben két olyan script van amelyik screen-t használ, és csak az egyik indul el. Így nekem is manuálisan kell indítanom az egyik screen-t hívó szkriptet újraindítás után.

  • ecaddict

    senior tag

    válasz ecaddict #3694 üzenetére

    Sikerult beállítanom a rtorrentet. Ha valakit érdekel, ime a konfigom (nem garantált, hogy minden környezetben működik, csak óvatosan):
    /opt/etc/rtorrent.conf

    min_peers = 20
    max_peers = 40
    max_uploads = 5
    download_rate = 180
    upload_rate = 36
    directory = /mnt/protected/torrent/work/
    schedule = watch_directory,5,5,load_start=/mnt/protected/torrent/dl/*.torrent
    schedule = untied_directory,5,5,stop_untied=
    scgi_port = localhost:5000
    session = /mnt/protected/torrent/session
    port_range = 51777-51780
    #port_random = no
    #check_hash = no
    #use_udp_trackers = yes

    schedule = ratio,30,60,stop_on_ratio=200

    # Encryption options, set to none (default) or any combination of the following:
    # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
    encryption = allow_incoming,enable_retry,prefer_plaintext

    # disable/off/auto/on
    # dht = auto

    # UDP port to use for DHT.
    # dht_port = 6881

    /opt/etc/init.d/S99rtorrent

    #!/bin/sh

    config="/opt/etc/rtorrent.conf"
    OPTIONS="-n -o import=${config}"
    BASE="/opt/share/torrent"
    SRNAME=rtorrent
    logfile="/opt/var/log/rtorrentInit.log"
    PATH=/opt/bin:/opt/sbin:/usr/bin:/sbin:/bin:/usr/sbin
    DESC=rtorrent
    NAME=rtorrent

    # Do not proceed unless some apps are available.
    test -x /opt/bin/screen || ( echo "screen not found." | tee -a "$logfile" >&2 ; exit 2 )

    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" >&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" >&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" >&2
    exit 3
    fi
    }

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

    getprange() {
    ports=`awk '/^[[:space:]]*port_range[[:space:]]*=[[:space:]]*/{print($3)}' "$config" | sed "s/-/ /"`
    echo $ports
    }

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

    fwopen() {
    DHT_PORT=`getdhtport "$config"`
    iptables -D INPUT -j DROP
    PORTS=$(seq `getprange "$config"`)
    for P in $PORTS; do
    iptables -I INPUT -i vlan1 -p tcp --syn --dport $P -j ACCEPT
    done
    if [ $DHT_PORT ]; then
    iptables -I INPUT -i vlan1 -p tcp --dport $DHT_PORT -j ACCEPT
    fi
    iptables -A INPUT -j DROP
    }

    fwclose() {
    DHT_PORT=`getdhtport "$config"`
    PORTS=$(seq `getprange "$config"`)
    for P in $PORTS; do
    iptables -D INPUT -i vlan1 -p tcp --syn --dport $P -j ACCEPT
    done
    if [ $DHT_PORT ]; then
    iptables -D INPUT -i vlan1 -p tcp --dport $DHT_PORT -j ACCEPT
    fi
    }

    d_start() {
    [ -d "${BASE}" ] && cd "${BASE}"
    fwopen
    stty stop undef && stty start undef
    \screen -ls | grep ".$SRNAME[[:space:]]" > /dev/null || \screen -dm -S $SRNAME
    \screen -S "$SRNAME" -X screen rtorrent $OPTIONS 2>&1 1>/dev/null | tee -a "$logfile" >&2
    }

    d_stop() {
    fwclose
    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
    }

    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: $0 {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
    esac

    exit 0

    Néhány megjegyzés:
    1. Mielőtt bárki átírja a package által feltett fájlokat, mentse el ui. némiképp átírtam amit a
    package feltesz
    2 Alapból a package az /opt/share-be teszi a könyvtárakat ahova a fájlok mennek ezt mindenképpen
    át kell másolni valahova ahol több hely van (nálam ez a /mnt/protected ), azaz az rtorrent.conf
    file-t mindenképpen át kell írni több helyen is
    3. Terminálból is indítható az init.d könyvtárból ./S99rtorrent start (stop: ./S99rtorrent stop)
    4. Előtte persze futtathatóvá kell tenni, ha még nem volt az (chmod u+x S99rtorrent)
    5. A script a konfig file-ból felolvassa a portokat és megnyitja a firewall-on (talán ez a
    legnagyobb módosítás amit beleraktam), ha valaki a post-firewall-ból szeretné fixen nyitni a
    fwopen, fwclose-t ki kell kommentezni (egyébként duplán lesz meg a rule vsz. nagyobb bajt
    nem okoz)

    Az ntorrent felülete egyébként nem nagyon győzött meg (teljesen használható, de néhány infót
    nem találtam meg amit a rtorrent/screen alatt látni lehet (pl. peerek száma); belépés: screen -r,
    kilép: Ctrl+a d)

    rtorrent-esek, nálatok mennyi a max letöltési sebesség mielőtt a load felmegy 1-re? Nálam a tranmission-nél ez kb.
    150kB.

    Verzíók:
    -10 es Oleg
    rtorrent - 0.8.2-1
    screen - 4.0.3-2

    ### RT-N16, WL-500 Oleg optware script ami majdnem mindent feltesz ### ===========> http://wl500g.info/showthread.php?t=23684 <===========

Új hozzászólás Aktív témák