Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: automatische downloads mit enhanced-ctorrent

  1. #1

    automatische downloads mit enhanced-ctorrent

    das ich mit dem torrent und transmission paket nicht zufrieden war, habe ich mir ein bash-script geschrieben,
    dass torrentdateien in einem ordner erkennt und diese dann mit dem enhanced-ctorrent runterläd

    Code:
    #!/bin/sh
    DL_DIR=/tmp/harddisk/Download;
    
    if [ "$(ps | grep -i "enhanced-ctorrent" | grep -v grep)" ]
    then
        echo "[`date`] tqueue: ctorrent already running" >> $DL_DIR/.log ;
        break ;
    else
        echo "[`date`] tqueue: looking for new torrent" >> $DL_DIR/.log ;
    
        cd $DL_DIR/active ;
        mv * $DL_DIR/ready ;
    
        cd $DL_DIR/queue ;
    
        for NAME in `find -name "*.torrent"` ;
        do
            echo "[`date`] tqueue: new torrent found, downloading $NAME" >> $DL_DIR/.log ;
    
            mv $NAME $DL_DIR/active ;
            cd $DL_DIR/active ;
    
            `enhanced-ctorrent -e 0 -U 15 $NAME` ;
    
            break ;
        done
        
        echo "[`date`] tqueue: no new torrent found" >> $DL_DIR/.log ;
    fi
    installationsanleitung:

    die festplatte muss auf /tmp/harddisk gemountet sein (oder die DL_DIR variable ändern), es ist praktisch eine große
    swap partition zu haben (um gute downloadraten zu erzielen, kann der ctorrent schon so ca 60mb verbrauchen)

    1) es müssen folgende pakete installiert sein:
    Code:
    cron
    findutils
    enhanced-ctorrent
    ich glaube das wars schon, bitte berichtigen, ich weiß es nicht genau

    2) das script in den /opt/bin ordner tun und ausführbar machen
    Code:
    chmod +x /opt/bin/tqueue
    3) auf der festplatte 4 ordner erstellen:
    Code:
    Download/
    Download/active/
    Download/queue/
    Download/ready/
    4) in der crontab muss die $PATH variable so aussehen:
    Code:
    PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    dann den job hinzufügen:
    Code:
    */30 * * * * admin /opt/bin/tqueue
    5) jetzt den cron deamon oder den ganzen router neustarten.

    6) jetzt können .torrent dateien einfach in dem queue ordner abgelegt werden, jede halbe stunde wird dort
    nachgeguckt und wenn kein download läuft wird ein neuer gestartet. fertige downloads kann man dem ordner
    ready entnehmen. es wird immer eine torrent datei nach der anderen runtergeladen. eine logdatei befindet
    sich im Download-Ordner (.log)

    achtung: nach einem neustart wird der download nicht fortgesetzt, sondern unfertig verschoben, dafuer
    habe ich noch keine tolle loesung gefunden, sorry

    ich wuensche euch viel spaß damit, fragen und anregungen willkommen
    Attached Files Attached Files
    Last edited by carterb; 02-11-2009 at 09:41.

  2. #2
    neue, bessere version des scriptes, was auch abgebrochene downloads weiterführt

    Code:
    #!/bin/sh
    DL_DIR=/tmp/harddisk/Download;
    
    if [ "$(ps | grep -i "enhanced-ctorrent" | grep -v grep)" ]
    then
        echo "[`date`] tqueue: enhanced-ctorrent already running" >> $DL_DIR/.log ;
        break ;
    else
        echo "[`date`] tqueue: looking for interrupted torrent" >> $DL_DIR/.log ;
    
        cd $DL_DIR/active ;
        
        for NAME in `find -name "*.torrent"` ;
        do
            echo "[`date`] tqueue: interrupted torrent found, downloading $NAME" >> $DL_DIR/.log ;
    
            `enhanced-ctorrent -e 0 -U 12 $NAME` ;
    
            mv * $DL_DIR/ready ;
    
            exit ;
        done
    
        echo "[`date`] tqueue: no interrupted torrent found, looking for new one" >> $DL_DIR/.log ;
    
        cd $DL_DIR/queue ;
    
        for NAME in `find -name "*.torrent"` ;
        do
            echo "[`date`] tqueue: new torrent found, downloading $NAME" >> $DL_DIR/.log ;
    
            mv $NAME $DL_DIR/active ;
            cd $DL_DIR/active ;
    
            `enhanced-ctorrent -e 0 -U 12 $NAME` ;
    
            mv * $DL_DIR/ready ;
    
            exit ;
        done
        
        echo "[`date`] tqueue: no new torrent found" >> $DL_DIR/.log ;
    fi
    Attached Files Attached Files

  3. #3
    Join Date
    Feb 2006
    Location
    Düsseldorf
    Posts
    277
    Hi,

    danke, echt klasse! Sag mal, wie schnell kann man mit ctorrent saugen? Einige berichten hier, dass das langsam gehen soll.

    Norbert

  4. #4
    also meine leitung is bei guten torrents dicht

    ich hab dem router (wl500gp) 120mb swap gegeben und davon macht er auch so 60 mb voll. der prozessor is schnell genug, die ports auf jeden fall freischalten, geht am besten mit der post-firewall, alles andere hat bei mir nicht funktioniert. wie ich ihn starte siehst du ja im skript - wie gesagt: geht gut ab

    meine post-firewall:

    Code:
    # open for torrents enhanced ctorrent
    iptables -D INPUT -j DROP
    iptables -A INPUT -p tcp --dport 2706 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2706 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2705 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2705 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2704 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2704 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2703 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2703 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2702 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2702 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2701 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2701 -j DNAT --to-destination
    iptables -A INPUT -p tcp --dport 2700 -j ACCEPT
    iptables -t nat -A PREROUTING -i $1 -p tcp --dport 2700 -j DNAT --to-destination
    iptables -A INPUT -j DROP
    wenn du nur ein ctorrent anhast, reicht auch ein port - ich hab sicherheitshalber mal noch mehr aufgemacht, wenn ich torrents parallel laufen lassen will. der nimmt 2706 und geht dann abwärts wenn er schon besetzt is
    Last edited by _H_o_L_E_; 11-11-2006 at 17:59.

  5. #5
    Quote Originally Posted by legolas View Post
    Hi,

    danke, echt klasse! Sag mal, wie schnell kann man mit ctorrent saugen? Einige berichten hier, dass das langsam gehen soll.

    Norbert

    hab am WL-HDD ca 2 MBit/s erreicht, also knapp unter FTP-Speed, allerdings mit OpenWrt

    ms

  6. #6
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    118
    Hallo _H_o_L_E_,

    danke erstmal nochmal für das tolle Script zum automatischen Downloaden. Ist bei mir im Einsatz und läuft echt super

    Hätte allerdings noch einen Vorschlag. Ich schau gerne zwischendurch mal nach wie weit der Download bisher fortgeschritten ist.
    Da er ja bei Dir das alles im Hintergrund macht ist eine kleine Modifikation dafür nötig.

    Code:
    `screen -S $NAME enhanced-ctorrent -e 0 -U 12 $NAME` ;
    das Rot markierte jeweils vor den Startbefehl vom enhanced ctorrent in dem Script schreiben.
    Dadurch wird jeweils eine neue Screen Session erzeugt mit dem Namen des Torrents.
    Will man nun kontrollieren wie weit diese sind, einfach im Router neu einloggen und mit screen -r die Sessions wieder anhängen

    Hoffe das können ein paar hier gebrauchen.

    Gruß FastJack

  7. #7
    sehr gute idee, danke fuer den tipp

  8. #8
    vielleicht doch keine so gute idee? bei mir funktioniert das irgendwie nicht, wenn ich das script per hand starte gehts, aber sobald der cron das macht, dann wird das screen sofort beendet und das script wird weiter abgearbeitet. weiß jemand woran das liegen koennte?

  9. #9
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    118
    Hi,

    habe leider auch das gleiche festgestellen müssen.
    Scheint wohl irgendwie an Cron und Screen zu hängen. Scheint so auszusehen das Screen nicht per cron aufgerufen werden kann sondern nur aus einer Console raus. Hab leider bisher auch keine Lösung gefunden. Mal nochmal das Screen Manual anschauen

    Sorry _H_o_L_E_

  10. #10
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    118
    like the last poster said:
    screen is the solution to solve your problem.

    but i want to add something:

    if you want to start some torrents automatically (ALT-seeds and some long-lasting leeches) you can additionally create a configfile:
    screenrc
    and start screen with:
    screen -c screenrc

    my config looks like:
    #############
    screen 1 enhanced-ctorrent -C 0 -M 20 -U 20 -f -s "/opt/share/seed/save1" "/opt/share/seed/torrent1.torrent"
    screen 2 enhanced-ctorrent -C 0 -M 20 -U 20 -f -s "/opt/share/seed/save2" "/opt/share/seed/torrent2.torrent"
    screen 3 enhanced-ctorrent -C 0 -M 20 -U 30 -s "/opt/share/leech/save" "/opt/share/leech/torrent3.torrent"
    #############
    so the first 2 screen-Windows will be started with 2 seeding torrent and 20K/s Upload-Limit
    and the third screen-window automatically starts a leech for torrent3 with 30 K/s upload-Limit

    so you don't have to start all the torrents manually after rebooting your router. you only have to start screen with your config-file.

    i normally have 10 torrents in seeding-State. so i got a little sick of starting them all manually.
    with the screenrc you also can configure your screen in many ways (statusbar on the bottom, binding of keys, ...). google for screenrc and you will find some examples...
    Hab das gerade im Forum gefunden. Ich denke wenn man das so abändert das z.B. das drinnsteht :
    (Die .screenrc im Homeverzeichniss anlegen)

    Code:
    #############
    startup_message off
    screen 1 /opt/bin/tqueue
    #############
    und dann im Cron nicht direckt auf die tqueue verweist sondern auf ein Script, z.B. ectorrent.sh in dem folgendes enthalten ist :

    Code:
    #!/bin/sh
    screen -c /<Homeverzeichniss>/.screenrc
    und alle Screen eintr&#228;ge in der Original tqueue entfernt, sollte es doch so laufen ?
    Vorrausgesetzt ich hab gerade keinen Denkfehler gemacht Hab das nur gerade theorerisch durchgespielt.
    Gleich mal heute Abend noch probieren.

    Gru&#223; FastJack
    Last edited by FastJack; 01-12-2006 at 15:51.

  11. #11
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    118
    hmm scheint so auch probleme zu machen *grummel*

    Hab aber nu allerdings noch was anderes gefunden. In einem anderen Forum hat jemand ein selbstgeschriebenes Webinterface eingestellt.

    torrent 0.04.zip

    einfach die Liesmich.txt die enthalten ist lesen. PHP muss installiert sein und man muss 2 Variablen setzten in der php.ini. Bei mir l&#228;uft es mit lighttpd wunderbar.
    Mit thttpd hatte ich ein paar Probleme.
    Last edited by FastJack; 02-12-2006 at 12:39.

  12. #12
    ich habe seit neuestem das problem, dass ectorrent bei manchen torrents während des runterladens folgende meldung ausspuckt:

    Code:
    warn, write file failed while flush cache.
    danach gehts aber normal weiter, ich vermute aber, dass er das aktuelle stueck nicht auf der festplatte gespeichert hat

    dann kommt noch dazu, dass der ectorrent manchmal mit der meldung

    Code:
    Bad System Call
    abstürzt.

    ich habe die dumpfe vermutung, dass es an der festplatte liegt, weil die nur mit einem usbkabel phne zusätzliche stromversorgung (2,5 zoll) angeschlossen ist, obwohl ich nicht hoeren konnte, dass sie aussetzt.

    hat da wer eine idee?

  13. #13
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    118
    Was f&#252;r ein USB Kabel hast den da drann? Ich w&#252;rde da mal so ein Y Kabel empfehlen das habe ich auch eins f&#252;r meine 2,5" Festplatte.
    Selber hatte ich die von Dir beschriebenen Probleme noch nicht, w&#252;rde aber auch wie Du mal in die richtung tippen.

    Gru&#223; FastJack

  14. #14
    Hi!

    Thanks for that tutorial. cTorrent seems to be running on my Asus-WLAN-HD now, but only if i start the script manually:

    PHP Code:
    /opt/bin/tqueue 
    at least netstat says:
    PHP Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State      
    tcp        0      0 noname
    :2706             chello212017087151:1364 ESTABLISHED 
    I installed cron but i can’t figure out how to run it. Maybe it is just because i don’t know how to configure cron. My crontab looks like this:

    PHP Code:
    SHELL=/bin/sh
    PATH
    =/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    MAILTO
    =""
    HOME=/
    # ---------- ---------- Default is Empty ---------- ---------- #
    */30 * * * * admin /opt/bin/tqueue 
    Maybe i am messing things up, but i would appreciate very much if the OP could write a litle info on his step 4.

    Maybe this gives some info?
    PHP Code:
    [admin@Nirvana root]$ cron
    cron
    can't lock /opt/var/run/cron.pid, otherpid may be 95: Resource temporarily unavailable 
    i searched my Asus but there is no log generated by cron, so what could be wrong?

  15. #15
    Oopsydaisy, nochmal in Deutsch:

    Quote Originally Posted by Winne2Koslowski View Post
    Hi!

    Vielen Dank für das Tutorial! cTorrent scheint bei mir aber nur zu laufen, wenn ich das script selber aufrufe:

    PHP Code:
    /opt/bin/tqueue 
    netstat meint (unter anderem):
    PHP Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State      
    tcp        0      0 noname
    :2706             chello212017087151:1364 ESTABLISHED 
    Cron ist installiert, aber ich weiß nicht so genau, wie ich Schritt 4 im ersten Post umsetzen soll. Meine crontab sieht so aus:

    PHP Code:
    SHELL=/bin/sh
    PATH
    =/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    MAILTO
    =""
    HOME=/
    # ---------- ---------- Default is Empty ---------- ---------- #
    */30 * * * * admin /opt/bin/tqueue 


    Sagt das was über meine cron Konfiguration?
    PHP Code:
    [admin@Nirvana root]$ cron
    cron
    can't lock /opt/var/run/cron.pid, otherpid may be 95: Resource temporarily unavailable 
    Ich habe die Asus durchsucht, aber ich finde kein log von cron

Page 1 of 2 12 LastLast

Similar Threads

  1. Enhanced CTorrent
    By madseh in forum WL-500g Q&A
    Replies: 34
    Last Post: 22-08-2007, 21:24
  2. Internet Radio mit WL500g und Telegent TG100 Air Media bei ausgeschaltetem PC
    By el_diablo in forum German Discussion - Deutsch (DE)
    Replies: 10
    Last Post: 02-08-2006, 19:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •