1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Announce] BitTorrent support for NAS200 running jac2b

Discussion in 'Cisco/Linksys Network Storage Devices' started by jackito, Apr 14, 2009.

  1. jackito

    jackito LI Guru Member

    I´m pleased to announce BitTorrent support for NAS200 running jac2b firmware.

    Using enhanced c-torrent + dctcs you can download your torrents directly from NAS200 through a web interface.
    I implemented this using to different packages:

    1- Enhanced C-Torrent a nice console bittorrent client.
    2- dctcs a web interface to control c-torrent through ctcs protocol.

    For c-torrent to run you will also need the libstdc++.so.5 library (you can use LD_LIBRARY_PATH as an enviroment var) included in the c-torrent package.

    You can run both of them or just c-torrent (but the web interface is much more practical and friendly).

    Get the packages from here:
    1- c-torrent.
    2- Full Package (ctorrent+dctcs).

    Install instructions for the Full Package (automatic startup on system reboot):

    • Unpack the tarball under /harddisk/volume_X/data/rc.d (Replace X with the correct volume number for you. Also you can unpack the tarball anywhere else in the harddisk but it will not startup automatically on system reboot unless you modify the rc.dctcs script in the tarball and copy it to /harddisk/volume_X/data/rc.d)
    • Change the login username and password in the dctcs.conf file.
    • Execute run.dctcs script to start dctcs
    • Connect to http://NAS_200_IP_ADDR:18000/
    • Login with the username and password that you set up previously in the config file

    ADVICE: ctorrent can be really heavy for the NAS200 CPU. So a good advice is to renice the ctorrent process after starting it. By "renicing" it you can low down the priority of ctorrent process so the rest of the services on the NAS can keep working. renice is available in my new version of busybox, check the thread about it.

    Enjoy! :thumbup:
     
  2. oferta.cerere

    oferta.cerere Addicted to LI Member

    can give us, pls, a simple jobaids how to install, running the programs?
     
  3. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Cool! A lot of people will be very happy to hear this.

    Too bad the tarballs you provide are completely unusable as they are. The directory structures make no sense because the file system is read-only.

    I downloaded both files and I'm able to run both ctorrent and dctcs but the command line parser of dctcs seems to be a little buggy or maybe the help (from "dctcs -h") is outdated, because I can't pull up any web pages. It kinda looks like I'm unable to make dctcs understand where the html root directory is.

    I wrapped up what I have, and made it available at http://www.goudsm.it/nas200/ctorrent.tgz. This contains ctorrent as well as dctcs, however this does NOT work. It's meant to be unpacked to the root directory of the first harddisk. The programs are stored in rc.d/ctorrent and there also is a startup script rc.d/rc.dctcs that starts the dctcs program. After unpacking you may also have to copy the dctcs.conf file to /etc (this should really be done in the rc.dctcs file but I only just remembered it and it's already uploading to the website). Another problem is that the rc.dctcs file should probably kill any running instances first using "killall dctcs".

    If anyone can figure what's wrong, feel free to comment in this thread, or (even better) wrap up a working version and let us know.

    ===Jac
     
  4. jackito

    jackito LI Guru Member

    Sorry for the lack of documentation about how to run it in NAS200.

    First lets start with the extraction of packages part.
    Of course you can´t untar this packages in the root FS because as Jac said it is read-only.
    I personally have something that try to look like a root FS in the "CONF" partition of my RAID-1. (ie: /harddisk/volume_3/conf/, /harddisk/volume_3/conf/etc, /harddisk/volume_3/conf/usr and so on). I put all my addons under that tree.
    Of course this is only my way of organization but you can untar the packages in wherever place you like in the harddisk.
    If you do for example:

    Code:
    # cp e-ctorrent-dnh3.3.2-NAS200.tar.gz /harddisk/volume_X/data/whatever_dir_i_want
    # cd /harddisk/volume_X/data/whatever_dir_i_want
    # tar -zxvf e-ctorrent-dnh3.3.2-NAS200.tar.gz
    
    You will get to directories under whatever_dir_i_want lib and usr (full path example: /harddisk/volume_X/data/whatever_dir_i_want/lib).

    Anyway if you want to put all the content of whatever_dir_i_want/lib and whatever_dir_i_want/usr/sbin in whatever_dir_i_want feel free to do it. ctorrent for example will still work.

    Now I will try to be as clear as possible.

    Let´s split the installation in two parts: ctorrent and dctcs.

    c-torrent:

    1- Untar the e-ctorrent-dnh3.3.2-NAS200.tar.gz file
    2- ctorrent NEEDS libstdc++.so.5 library to run so you need to let the system know where he can find the library. You can do it by exporting an enviroment variable LD_LIBRARY_PATH with the path to the library. For example:
    Code:
    export LD_LIBRARY_PATH=/harddisk/volume_3/conf/lib:$LD_LIBRARY_PATH
    3- Now you can run c-torrent by going to the place where the file is and executing:
    Code:
    ./ctorrent
    Of course the c-torrent executable MUST have execution rights (755 is ok).

    For c-torrent options you can run:
    Code:
    ./ctorrent -h
    And also check the documentation at Enhanced C-Torren site (you can find the link in the first post of this thread).
    An execution example for c-torrent is:
    Code:
    ./ctorrent my_first_download.torrent
    This will start downloading my_first_download.torrent . Again please check the docs at c-torrent site to learn more about it.

    Now just for the record you don´t need dctcs for c-torrent to run. But of course is a lot more easy to admin your torrents with dctcs.

    dctcs:

    1- Untar the dctcs-0.7.2-NAS200.tar.gz file. You will get a tree with etc, usr/bin and usr/share/dctcs/www/darkside.ctcs.gui. Again you if you want you can put all the files together under the same directory.
    2- Edit the file under dctcs.conf under etc. Let me explain some parameters of the file:

    Code:
    #sample config file
    
    #change these according to your system
    torrent-directory=/mnt/disc0_1/torrent/  <-- The path where you want to store the torrents that you upload with the web interface and where ctorrent look for start downloading
    download-directory=/mnt/disc0_1/         <-- The patch where you want ctorrent to download "the torrent content"
    
    #change user name and password
    user=me  <-- Web interface username
    password=just  <-- Web interface password
    
    exit-hours=168  <-- c-torrent tunning/options please read c-torrent documentation
    exit-ratio=5.6  <-- c-torrent tunning/options please read c-torrent documentation
    cache-size=1  <-- c-torrent tunning/options please read c-torrent documentation
    restart-torrents=0  <-- Set this option to 1 if you want dctcs to start downloading your torrents inmediately after starting
    
    download-limit=0  <-- Download BW limit Kb/s
    upload-limit=0  <-- Upload BW limit in Kb/s
    
    #check-interval=0  <-- The interval in minutes that dctcs use to check torrent-directory for new torrents to download
    
    #port=18000  <-- The port where you want dctcs web interface to listen for clients (default 18000). You can leave it comment to use the default.
    
    #arbitrary arguments to ctorrent  <-- I´m not sure what is this for I don´t use it
    #ctorrent-args=-a  <-- I´m not sure what is this for I don´t use it
    #run command after download complete see ctorrent -X for details
    #ctorrent-complete=command  <-- I´m not sure what is this for I don´t use it
    
    #url to prepend in the details box
    #detail-url=ftp://192.168.1.1/mnt/disc0_1/  <-- I´m not sure what is this for I don´t use it
    
    #arbitrary arguments to wget
    #wget-args=-c  <-- I´m not sure what is this for I don´t use it
    
    #write-stats=1  <-- Set this to one if you want dctcs to write stats about your torrents download
    #ctorrent=/usr/bin/ctorrent  <-- Path to ctorrent binary. You will need to change this for sure. Point it to path where the file reside.
    #client-host=localhost:15000  <-- Listening port for dctcs to communicate with ctorrent. Leave the default.
    #htmlroot-directory=/usr/share/dctcs/www/darkside.ctcs.gui/ <-- Path to web interface files. You will need to change this for sure. Point it to path where the files reside.
    #wget=/usr/bin/wget  <-- Path to wget binary. You will need to change this for sure. Point it to path where the file reside.
    3- Go to the directory where the dctcs binary file reside.
    4- Run dctcs with -c option and point it to your dctcs.conf file.
    Code:
    ./dctcs -c path_to_dctcs.conf_file
    You will see that dctcs will complain about not finding the conf file in /etc but you can discard this warning or just put your dctcs.conf file under /etc and run dctcs without the -c option.
    5- Open Mozilla (dctcs has auth problems with IE) and go to http://your.NAS200.IP.address:18000/
    6- Login with the username and password that you set in the dctcs.conf file.

    That´s all.
    Please keep in mind file permissions. Binary files MUST have at least execution permission for root to run and the rest of the files MUST have at least read permission for root.
    As Jac did/said you can write a startup script or use Jac´s one if you want to start dctcs on NAS200 startup.
    If something is not clear or you face problems trying to make this work, please ask in this thread and I will answer ASAP. :wink:
    And last but not least please check the software docs at the website for fine tunning and full list of options (at least for ctorrent).

    Fernando
     
  5. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    On the NAS200, use tar xvz -f e-ctorrent-dnh3.3.2-NAS200.tar.gz instead. The -f argument can't be combined with the xvz argument, this is a quirk in Busybox.

    Still trying to find out why all I get from dctcs is a blank page (using Firefox 3.0.8)... Guess I should take a look at the source code, maybe this weekend.

    ===Jac
     
  6. jackito

    jackito LI Guru Member

    Sorry Jac but it is working ok for me without separating the arguments. :confused:
    Im using the busybox version that comes with your jac2b firmware (BusyBox v1.00-rc2) at least for tar.
    Maybe is working for me because Im using busybox 1.13.3 as shell?

    Regarding the blank page for dctcs I don´t know what to say. Did you check the path to the web if files? Permissions all down the path? Permissions on the files?

    This is how my dctcs.conf file looks like (some parameters are ofuscated to protect the inocent):

    Code:
    #sample config file
    
    #change these according to your system
    torrent-directory=/harddisk/volume_3/data/xxxxxxxxx/No_Backup/Torrents/
    download-directory=/harddisk/volume_3/data/xxxxxxxxx/No_Backup/Torrents/Downloads/
    
    #change user name and password
    user=myuser
    password=whocares
    
    exit-hours=72
    exit-ratio=1.5
    cache-size=1
    restart-torrents=1
    
    download-limit=200
    upload-limit=8
    
    check-interval=10
    
    #port=18000
    
    #arbitrary arguments to ctorrent
    #ctorrent-args=-a
    #run command after download complete see ctorrent -X for details
    #ctorrent-complete=command
    
    #url to prepend in the details box
    #detail-url=ftp://192.168.1.1/mnt/disc0_1/
    
    #arbitrary arguments to wget
    #wget-args=-c
    
    write-stats=1
    ctorrent=/harddisk/volume_3/conf/usr/sbin/ctorrent
    #client-host=localhost:15000
    htmlroot-directory=/harddisk/volume_3/conf/usr/share/dctcs/www/darkside.ctcs.gui/
    wget=/usr/bin/wget
    Keep in mind that the paths that point to directories end with slash.

    Also this are my permissions down the htmlroot-directory:

    Code:
    root@NAS200 /harddisk/volume_3/conf/usr# ll -R share/
    share/:
    drwxr-xr-x    3 root     root         1024 Apr 11 02:30 dctcs
    
    share/dctcs:
    drwxr-xr-x    3 root     root         1024 Apr 13 17:51 www
    
    share/dctcs/www:
    drwxr-xr-x    2 root     root         1024 Apr 11 03:41 darkside.ctcs.gui
    
    share/dctcs/www/darkside.ctcs.gui:
    -rw-r--r--    1 root     root          295 Apr 11 02:27 14A43CD7E24B0A0136C2B8B20D6DF3C0.cache.png
    -rw-r--r--    1 root     root           92 Apr 11 02:27 548CDF11D6FE9011F3447CA200D7FB7F.cache.png
    -rw-r--r--    1 root     root       190183 Apr 11 02:27 57165C55510258259673CA180361FFDC.cache.html
    -rw-r--r--    1 root     root       188232 Apr 11 02:27 6A4F87D7A546BD56855B47DD138315E8.cache.html
    -rw-r--r--    1 root     root           90 Apr 11 02:27 9DA92932034707C17CFF15F95086D53F.cache.png
    -rw-r--r--    1 root     root          291 Apr 11 02:27 B8517E9C2E38AA39AB7C0051564224D3.cache.png
    -rw-r--r--    1 root     root       190569 Apr 11 02:27 C66F0435CAE65C97D2FD97E800B8A68D.cache.html
    -rw-r--r--    1 root     root       190448 Apr 11 02:27 D90912F652F63CF0839027DACA563C61.cache.html
    -rw-r--r--    1 root     root       185838 Apr 11 02:27 DE37AA9D04C1DF006CD832E018EC5249.cache.html
    -rw-r--r--    1 root     root           43 Apr 11 02:27 clear.cache.gif
    -rw-r--r--    1 root     root         5341 Apr 11 02:27 darkside.ctcs.gui.nocache.js
    -rw-r--r--    1 root     root          318 Apr 11 02:27 favicon.ico
    -rw-r--r--    1 root     root          866 Apr 11 02:27 gray_gradient.gif
    -rw-r--r--    1 root     root         6022 Apr 11 02:27 gui.css
    -rw-r--r--    1 root     root         1480 Apr 11 02:27 gui.html
    -rw-r--r--    1 root     root          436 Apr 11 02:27 history.html
    -rw-r--r--    1 root     root         1408 Apr 11 02:27 hosted.html
    -rw-r--r--    1 root     root          819 Apr 11 02:27 logo.gif
    -rw-r--r--    1 root     root         3151 Apr 11 02:27 messages.properties
    And for the binaries and conf files and torrents directories:

    Code:
    root@NAS200 /harddisk/volume_3/conf/usr/bin# ll
    -rwxr-xr-x    1 root     root       170590 Apr 11 01:50 dctcs
    
    root@NAS200 /harddisk/volume_3/conf/usr/sbin# ll
    -rwxr-xr-x    1 root     root       899548 Apr 10 16:55 ctorrent
    
    root@NAS200 /harddisk/volume_3/conf/etc# ll
    -rw-r--r--    1 root     root          868 Apr 14 10:01 dctcs.conf
    
    root@NAS200 /harddisk/volume_3/data/xxxxxxxxx/No_Backup# ll
    drwxrwxrwx    4 fcasas   all          4096 Apr 14 09:50 Torrents
    
    root@NAS200 /harddisk/volume_3/data/xxxxxxxxx/No_Backup/Torrents# ll
    drwxr-xr-x    3 root     root         4096 Apr 12 05:13 Downloads
    That´s all I can think off. Oh, that and of course checking dctcs site, I think they have a forum, maybe someone faced the same problem.
     
  7. jackito

    jackito LI Guru Member

    I´m wondering:

    From the posts in the thread. Is this working for anybody? Is it only working without problems for me? Did anybody else apart of Jac try it?

    It would be usefull to have some feedback, if somebody is using it, to know which problems did you face trying to make this work.
    Because if this is only working for a very little amount of people then I will try to check again the packages, the binaries and so on.
    I would like to know where are we standing.
    Thanks in advance for your inputs.

    Fernando
     
  8. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Alright I stand corrected. But the f has to be at the end of the first parameter, e.g. tar xvzf filename will work but tar xfvz filename will not. It's still a quirk in Busybox :)

    Aha. I fixed that in my startup script, copied your config file (adapted it for my separate-disk configuration), checked all permissions and stored the result on my website again at the location mentioned above. When I run it, I get a little further this time: The program actually serves pages now. But all I see is a lightblue page with nothing on it. The page source is:

    Code:
    <html>
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">	
    		<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon">
    		<!--                                           -->
    		<!-- Any title is fine                         -->
    		<!--                                           -->
    		<title>CTCS</title>
    
    
    		<!--                                           -->
    		<!-- The module reference below is the link    -->
    		<!-- between html and your Web Toolkit module  -->		
    		<!--                                           -->
    		<!-- meta name='gwt:module' content='darkside.ctcs.gui' -->
    		
    	</head>
    
    	<!--                                           -->
    	<!-- The body can have arbitrary html, or      -->
    	<!-- you can leave the body empty if you want  -->
    
    	<!-- to create a completely dynamic ui         -->
    	<!--                                           -->
    	<body>
    
    		<!--                                            -->
    		<!-- This script is required bootstrap stuff.   -->
    		<!-- You can put it in the HEAD, but startup    -->
    		<!-- is slightly faster if you include it here. -->
    		<!--                                            -->
    
    		<!-- <script language="javascript" src="gwt.js"></script> -->
    		<script language="javascript" src="darkside.ctcs.gui.nocache.js"></script>
    		
    		<!-- OPTIONAL: include this if you want history support -->
    		<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
    
    	</body>
    </html>
    
    I'll keep troubleshooting but any ideas are welcome... I may also try to compile a version that doesn't demonize and that outputs some debugging info to stdout instead of syslog.

    ===Jac
     
  9. jackito

    jackito LI Guru Member

    Jac, I checked the page source for me and it is exactly the same as yours but I get also a login form in the page (not the page source).
    Another thing that I was thinking off is: what happen if you try to reproduce my fs tree /harddisk/volume_X/conf/etc,lib,usr,usr/bin and so on? Specially the web interface path. I didn´t change the path at all, at least nothing after share/dctcs/www/darkside.ctcs.gui
    Just an idea maybe it is a path related problem.
    Another thing, DCTCS seems to be using javascript a lot, do you have JRE installed on your computer? I know javascript is not the same as Java, but maybe has something to do maybe not anyway it worth trying I think.
     
  10. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    I've seen the sample webpage on the yodctcs website so I know that's what I should be getting. I also know that the blue background must be coming from the javascript. So some javascript must at least be executed, just not all. Unfortunately I'm strictly old-school so I don't speak Javascript -- I can kinda read it if it's well-formatted but the code in the .js file (which I can also download through my browser just fine) is all piled up with no formatting at all, possibly on purpose...

    I tried opening the Java console and error console of Firefox but that didn't help: no output is generated.

    My intention is to provide a small tarball that people can just unpack on top of their rc.d directory (wherever that may be) so that it works "out of the box". I trust that you got it to work your way but I want to make it work for everyone else who doesn't know a whole lot about Linux -- personally I hardly ever use Torrent so I'm not doing it for myself.

    As for possible path related problems: I just moved the entire path under www to the base directory and apparently it works at least partially. I may have something wrong in the config file still (I used vi to manually copy your stuff).

    I wish dctcs would be a little more chatty about what it's doing but I think it's designed to throw all its messages to syslog and only if it's compiled in Debug mode.

    Yes I have JRE.

    ===Jac
     
  11. jackito

    jackito LI Guru Member

    Jac, keep in mind that the web files are "compiled" with google web toolkit.

    From DCTCS site:

    Code:
    ...the user interface is a dynamic web page written in Java and 
    compiled into JavaScript with Google Web Toolkit the server is 
    implemented in C...
    So to me it seems that the web if is just a rare monster half java half javascript....brrrrrrr

    This is what I´m going to do:

    I will create a tarball that includes:

    • ctorrent binary
    • libstdc++.so.5
    • dctcs binary
    • dctcs conf file (tuned for this setup, specially the paths)
    • dctcs web if

    All in the same path. I will test it and update the thread with the results.
    Like you Jac my goal is also to publish this "feature" for everyone, as simple as possible. :biggrin:
    BTW thanks for all your inputs!
     
  12. jackito

    jackito LI Guru Member

    Ok, the package is ready. You can get it here.

    Just unpack the files wherever place you want in the harddisk.
    ALL THE FILES NEEDED WILL BE UNPACKED IN THE SAME PLACE (except the web gui that will be unpacked in a subdirectory.
    Then edit the file dctcs.conf (I recommend to use Vi -it is available in NAS200- since for sure it will not mess the end of lines, and so on) to reflect the correct paths for everything. I can´t do it in advance because I don´t know where in the harddisk will you unpack the tarball. Keep in mind that if a path is wrong (more specifically the web gui) dctcs will not work but if for example the torrents or torrents-download path are wrong it will not even start.

    Then to start the app I wrote a little and simple script. Just execute run.dctcs.

    I tested this package and is working ok (also the previous one but this is simpler). I was able to login to the web gui and upload a .torrent file for testing.

    I hope this package is clearer and simpler to install and use.
    Good luck.
    Oh and please if you have any problems or questions, please ask. :thumbup:
     
  13. oferta.cerere

    oferta.cerere Addicted to LI Member

    when i try to download i've got this message:

    Not Found

    The requested URL /temp/test-torrent-support-NAS200.tar.gz was not found on this server.
    Apache Server at secdata.com.ar Port 80
     
  14. jackito

    jackito LI Guru Member

    Sorry, my mistake. The filename was changed by the ftp client I used to upload the file. Try again is working now.
     
  15. evdo

    evdo Guest

    Jackito, thanks a lot for your effort!! :thumbup:

    I had to change some settings in the dctcs.conf file, create some directories, exported the enviroment variable and then finally managed to download a torrent in DCTCS with Firefox.
     
  16. jackito

    jackito LI Guru Member

    evdo, great news and thank you for your feedback.
    Unfortunatelly everybody will need to change some settings in the dctcs.conf file (to fit your enviroment and needs), create some directories (torrent and downloads at least), and export the env var.
    But I think that all this is not too complex (believe me that compiling all this for NAS200 in Ubuntu was a lot more tricky) and it really worth the effort since having torrent support is another great addon.
    At least for me. :wink:
     
  17. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Yay! It works!

    However, instead of asking the users to change the configuration file depending on where they unpack the tarball, I would specifiy the directory-dependent options from the startup script so that you can use locations relative to the current directory. You will need to comment those options out from the config file; apparently the config file overrides command line options (this may be why it didn't work for me in the first place).

    Also, I would add the LD_LIBRARY_PATH override to the startup script so that users don't have to do that by hand.

    Here's my run.dctcs:
    Code:
    #!/bin/sh
    
    # Directory settings, modify as needed, note they need to end in '/'
    TORRENTDIR=$PWD/torrents/
    DOWNLOADDIR=$PWD/downloads/
    
    mkdir -p "$TORRENTDIR"
    mkdir -p "$DOWNLOADDIR"
    
    LD_LIBRARY_PATH=$PWD ./dctcs -c ./dctcs.conf \
    --torrent-directory="$TORRENTDIR" --download-directory="$DOWNLOADDIR" \
    --ctorrent=$PWD/ctorrent --htmlroot-directory=$PWD/darkside.ctcs.gui/
    
    And here is my modified dctcs.conf:
    Code:
    #sample config file
    
    #change these according to your system
    #torrent-directory=/harddisk/volume_3/data/xxxxxx/Torrents/
    #download-directory=/harddisk/volume_3/data/xxxxxx/Torrents/Downloads/
    
    #change user name and password
    user=me
    password=just
    
    exit-hours=72
    exit-ratio=1.5
    cache-size=1
    restart-torrents=1
    
    download-limit=200
    upload-limit=8
    
    check-interval=10
    
    #port=18000
    
    #arbitrary arguments to ctorrent
    ctorrent-args=-a
    #run command after download complete see ctorrent -X for details
    #ctorrent-complete=command
    
    #url to prepend in the details box
    #detail-url=ftp://192.168.1.1/mnt/disc0_1/
    
    #arbitrary arguments to wget
    wget-args=-c
    
    # Note, stats are written to fixed location /etc/dctcs.stat
    # so they will slowly fill up your memory 
    write-stats=0
    #ctorrent=/harddisk/volume_3/conf/tmp/ctorrent
    #client-host=localhost:15000
    #htmlroot-directory=/harddisk/volume_3/conf/tmp/darkside.ctcs.gui/
    wget=/usr/bin/wget
    
    Note, all I did was comment out the directories and filenames that I override from the command line, and I disabled the write-stats because it writes to a file in a RAM disk whose location cannot be altered at this time.

    If you modify the script and config file as shown above, users can unpack the tarball anywhere (as long as they keep everything together of course), and then all they need to do is set the access rights and run the script.

    If users unpack the tarball beneath rc.d in the root of their hard disk (e.g. in rc.d/ctorrent), the owner and access rights will automatically be set (to root and 777) by the Jac2b startup scripts, and if all they need is a script in rc.d as follows, to make dctcs automatically start at boot time.

    Code:
    #!/bin/sh
    ./ctorrent/run.dctcs
    
    The version that's online on my website doesn't have these changes yet, I will update it later today. Thanks again Jackito!

    ===Jac
     
  18. jackito

    jackito LI Guru Member

    Great suggestions Jac.
    Thank you very much, I created and uploaded a new package.
    Also I updated the announce.
    Again, thanks a lot!

    Fer
     
  19. mdsilva

    mdsilva Addicted to LI Member

    For us non smart users could the bittorrent client be included in a new firmware like Jac2c or something fully set up?
     
  20. jackito

    jackito LI Guru Member

    I don´t think I can answer this, maybe Jac?
    What I can tell you is that for now I´m not planning to release a new firmware even based on Jac´s excelent one.
    But your question is very interesting since it can be nice to have not only BitTorrent support but the next features/updates in an hipotetic jac2c firmware:

    • i-SCSI support (iET)
    • AoE support (vblade or qaoed I have both up and running)
    • Busybox 1.13.3 (with more apps than the standard one ie: top. I´m using this right now in parallel with the original version.)
    • Rsync
    • BitTorrent support
    • NFS (I don´t have it installed or tried it but it is a goor feature to have)
    • aMule (I have it up and running currently but I´m working on a simple installation package that I will release during this week I hope)

    Of course all of this sounds great but you have to keep in mind that the firmware flash memory is limited to 8MB so probably not even half of this features will fit there (aMule -very big package- and BitTorrent are a very good example) but on the other hand AoE, Busybox, Rsync and maybe, maybe i-SCSI will do it also. :frown:
    So I think we should keep some of them only as an add-on.
    Jac, correct my if I´m wrong.
     
  21. mdsilva

    mdsilva Addicted to LI Member

    Hi, how do i know which volume to use? none of my volumes has a /data/rc.d
    Do I create that directory on any of my hard drives?

    I currently have two drives, volume_1 is where i have put ctorrent and volume_2 is my other hard drive.

    Not sure if this is useful but i used to combined package to get the torrent working, just untared and changed the dirs and user/pass and it worked
     
  22. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    There will not be a Jac2c with Bittorrent built in. It's just too big (almost 2MB) to fit into the flash. Sorry...

    Once I get OpenWRT to run, it will be easier to select which packages are installed in the flash, which ones on the hard disk etc.

    ===Jac
     
  23. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    It sounds like your NAS is configured in "separate disk" mode. That means your first hard disk's data partition (/dev/sda1) is mounted on /harddisk/volume_1/data/ and your second hard disk's data partition (/dev/sda2) is mounted on /harddisk/volume_2/data/.

    You need to create the rc.d directory on /harddisk/volume_1/data/ or /harddisk/volume_2/data and work from there.

    If you unpacked the tarball under volume_1, it's stored in the RAM disk now, and it will be gone when you reboot.

    That's how we intended it, but if you untar it somewhere not on the hard disk, your stuff will be gone when you reboot, and your memory will fill up until it has no place to store anything, and it will probably freeze or start behaving weird.

    ===Jac
     
  24. mdsilva

    mdsilva Addicted to LI Member

    Thanks Jac, will try it tonight. :thumbup:

    Is it possible to schedule the torrent downloading somehow? (maybe with cron)

    It would be really cool if i could add torrent files to my nas200 in stoped mode and at 2am have my nas200 auto start downloading and at say 7am stop/pause the downloading.

    Does anyone know how to do this? :confused:
     
  25. mdsilva

    mdsilva Addicted to LI Member

    Slight update: I found a way to stop downloads at 7am. I put in a cron job that runs '/bin/killall ctorrent' which kills all my ctorrent processes.

    Still no idea how to start/resume all torrents (via cron). Any ideas?
     
  26. jackito

    jackito LI Guru Member

    Just execute ctorrent like this from crond:

    Code:
    ctorrent -S localhost:15000 your.torrent.file
    Your torrent will resume download and give control back dctcs. :wink:
     
  27. mdsilva

    mdsilva Addicted to LI Member

    Thanks will try that tonight.

    I have tried running ctorrent without the "-S localhost:15000" and the torrent starts but ignores the dctcs config file so the download path changes.

    Will let you all know if the -S helps.
     
  28. jackito

    jackito LI Guru Member

    Oh, you will also need to add this parameter:

    Code:
    -s filename     Download ("save as") to a different file or directory
    So your line will be something like:

    Code:
    ctorrent -S localhost:15000 -s your.download.path your.torrent.file
     
  29. mdsilva

    mdsilva Addicted to LI Member

    Hi, I got it to work (I think).

    -s does not have the desired outcome as it ignores the parent directory within the torrent (if it has one). To get around this my script cd's into the download dir and there it runns the ctorrent command. For Example:

    my start downloading during off peak times:
    Code:
    #!/bin/sh
    
    cd /harddisk/volume_X/data/public/torrent/ctorrent
    
    #restart dctcs, it crashes every now and then
    ./stop.dctcs >/dev/null 2>&1
    ./run.dctcs
    
    #where to download to
    cd /harddisk/volume_X/data/public/torrents/downloads/
    find /harddisk/volume_X/data/public/torrents/torrents/ -name '*.torrent' -print | while read file; do
            LD_LIBRARY_PATH=/harddisk/volume_X/data/public/torrent/ctorrent /harddisk/volume_X/data/public/torrent/ctorrent/ctorrent -S localhost:15000 -d $file
    done
    
    my start downloading during off peak times:
    Code:
    #!/bin/sh
    
    #stop torrent downloading
    /bin/killall ctorrent >/dev/null 2>&1
    sleep 10
    /bin/killall -9 ctorrent >/dev/null 2>&1
    
    cd /harddisk/volume_X/data/public/torrent/ctorrent
    
    #restart dctcs, it crashes every now and then
    ./stop.dctcs >/dev/null 2>&1
    ./run.dctcs
    
    volume_X is the volume you have the program/download locaions.

    :thumbup: Thanks for all your help everyone.
     
  30. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Hi!
    I've been following this forum for awhile, hoping that someone would improve the firmware in NAS200, and following all the development here. First of all, I'd like to compliment all of you for your efforts and the fantastic firmware tha jac developed. as a little feedback to you, I've succesfully installed jac2b on my nas200, and I noticed it's a little more responsive, speccially in retrieving directories and such. I have just one hard disk installed, 320Gb in size. The NAS is connected to my home network via a router, and I open files directly from there, no problem, no lag.

    Now, for a little question...

    Connected via telnet and winSCP, no problem. Then I've used winSCP to untar the ctorrent full package to harddisk/volume_1/data/rc.d . I've edited the config file to reflect the paths, and added a user name and password.
    When I reboot my device, the script doesen't run, and when I try to execute it directly, via telnet or via winscp, it says I have permissions denied. I've tryied everything, no success.
    I must add that I'm no power user, just a curious guy... my knowledge of linux is "user-grade", and I'm stuck with windows in my machines (I'm an architect, and my programs only run in windows)...
    Any help would be appreciated!
    Thanks, and sorry for my bad english (I'm brazilian!)
     
  31. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Did you try setting the owner using chown and the access rights using chmod?

    ===Jac
     
  32. jackito

    jackito LI Guru Member

    Hi Juliano and welcome!
    First of all let me tell you that I´m actually living in Spain but I´m from Argentina. A love your country. Great people, great beaches, great soccer!
    Now regarding your problem as Jac said you will need to check permissions and ownership of the script but also of the rc.d directory.
    To achieve this:

    Code:
    cd /harddisk/volume_1/data
    ls -l
    
    You will get a directory listing, search for something like this in the output:

    Code:
    drwxrwxrwx    2 root     root         4096 Apr 17 16:15 rc.d
    
    Note that rc.d directory is actually a directory (d) and has full permissions for root user (1st rwx), full permissions for root group (2nd rwx) and also full permissions for everyone else (3rd rwx). Also please note the ownership of the directory, this is root user (1st root) and root group (2nd root).
    If this is not the same for your rc.d directory please execute the following:

    Code:
    chown root.root rc.d
    chmod 777 rc.d
    
    Then execute again "ls -l" and you should see the permissions for rc.d set to full (rwx) for everybody and the ownership set to root user and group.

    Next step is to check the same for the script rc.dctcs under rc.d, so:

    Code:
    cd rc.d
    ls -l
    
    You will get an output like this one:

    Code:
    drwxr-xr-x    5 root     root         4096 Apr 23 20:59 ctorrent
    -rwxr-xr-x    1 root     root           35 Apr 17 16:18 rc.dctcs
    
    If you don´t, just fix it:

    Code:
    chown root.root rc.dctcs
    chmod 777 rc.dctcs
    
    Run "ls -l" again and verify that you get the same output for ctorrent directory and rc.dctcs file.
    Finally execute "./rc.dctcs". This will start dctcs, if you still have problems please come back and paste the text in the NAS telnet/ssh console.
    Also the output of "ls -lR" (inside rc.d directory) can be usefull so I can check the permissions of all the files and folders beneath it. :wink:
     
  33. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    First of all, thanks for your kind responses.

    I've followed the step by step instructions jackito posted, and everything went right until the end, , when I try to run the script and it still says "access denied"

    I'll paste everything here:

    Code:
    $ cd /harddisk/volume_1/data
    $ ls -l
    drwxr-xr-x    2 root     root            6 Jan 1
    drwxrwxrwx    6 admin    everyone       75 Apr 2
    drwxrwxrwx    3 root     root           36 Apr 2
    $ cd rc.d
    $ ls -l
    drwxr-xr-x    5 root     root         4096 Apr 2
    -rwxrwxrwx    1 root     root           35 Apr 1
    $ chown root.root rc.dctcs
    $ chmod 777 rc.dctcs
    $ ls -l
    drwxr-xr-x    5 root     root         4096 Apr 2
    -rwxrwxrwx    1 root     root           35 Apr 1
    $ ./rc.dctcs
    ./rc.dctcs: 4: ./run.dctcs: Permission denied
    Any ideas?
     
  34. jackito

    jackito LI Guru Member

    Yes, please execute this and paste all the output, also please note that in your last post you are missing the filenames:

    Code:
    cd /harddisk/volume_1/data/rc.d
    ls -lR
    
    Copy and paste all the output in a new post. :)
     
  35. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Oh, sorry... I've not been clear enough. What I've pasted up there was the actual output for the commands.

    I'll do it again, and paste everything to be more clear:

    Code:
    
    
    BusyBox v1.00-rc2 (2009.02.01-05:21+0000) Built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    
    $ cd /harddisk/volume_1/data/rc.d
    $ ls -lR
    .:
    drwxr-xr-x    5 root     root         4096 Apr 23 08:56 ctorrent
    -rwxrwxrwx    1 root     root           35 Apr 17 11:18 rc.dctcs
    
    ./ctorrent:
    -rw-r--r--    1 root     root       899548 Apr 16 11:00 ctorrent
    drwxr-xr-x    2 root     root         4096 Apr 21 17:53 darkside.ctcs.gui
    -rw-r--r--    1 root     root       170590 Apr 16 11:00 dctcs
    -rw-r--r--    1 root     root          928 Apr 23 07:58 dctcs.conf
    drwxr-xr-x    2 root     root            6 Apr 21 17:53 downloads
    -rw-r--r--    1 root     root      4268280 Apr 16 11:00 libstdc++.so.5
    -rw-r--r--    1 root     root          372 Apr 17 10:50 run.dctcs
    -rw-r--r--    1 root     root           30 Apr 16 15:28 stop.dctcs
    drwxr-xr-x    2 root     root            6 Apr 21 17:53 torrents
    
    ./ctorrent/darkside.ctcs.gui:
    -rw-r--r--    1 root     root          295 Apr 10 21:28 14A43CD7E24B0A0136C2B8B2
    0D6DF3C0.cache.png
    -rw-r--r--    1 root     root           92 Apr 10 21:28 548CDF11D6FE9011F3447CA2
    00D7FB7F.cache.png
    -rw-r--r--    1 root     root       190183 Apr 10 21:28 57165C55510258259673CA18
    0361FFDC.cache.html
    -rw-r--r--    1 root     root       188232 Apr 10 21:28 6A4F87D7A546BD56855B47DD
    138315E8.cache.html
    -rw-r--r--    1 root     root           90 Apr 10 21:28 9DA92932034707C17CFF15F9
    5086D53F.cache.png
    -rw-r--r--    1 root     root          291 Apr 10 21:28 B8517E9C2E38AA39AB7C0051
    564224D3.cache.png
    -rw-r--r--    1 root     root       190569 Apr 10 21:28 C66F0435CAE65C97D2FD97E8
    00B8A68D.cache.html
    -rw-r--r--    1 root     root       190448 Apr 10 21:28 D90912F652F63CF0839027DA
    CA563C61.cache.html
    -rw-r--r--    1 root     root       185838 Apr 10 21:28 DE37AA9D04C1DF006CD832E0
    18EC5249.cache.html
    -rw-r--r--    1 root     root           43 Apr 10 21:28 clear.cache.gif
    -rw-r--r--    1 root     root         5341 Apr 10 21:28 darkside.ctcs.gui.nocach
    e.js
    -rw-r--r--    1 root     root          318 Apr 10 21:28 favicon.ico
    -rw-r--r--    1 root     root          866 Apr 10 21:28 gray_gradient.gif
    -rw-r--r--    1 root     root         6022 Apr 10 21:28 gui.css
    -rw-r--r--    1 root     root         1480 Apr 10 21:28 gui.html
    -rw-r--r--    1 root     root          436 Apr 10 21:28 history.html
    -rw-r--r--    1 root     root         1408 Apr 10 21:28 hosted.html
    -rw-r--r--    1 root     root          819 Apr 10 21:28 logo.gif
    -rw-r--r--    1 root     root         3151 Apr 10 21:28 messages.properties
    
    ./ctorrent/downloads:
    
    ./ctorrent/torrents:
    $
    The oly difference I see from the expected output to my own is here:
    Code:
    -rwxrwxrwx    1 root     root           35 Apr 17 11:18 rc.dctcs
    It's funny, for that I can understand, the file has more permissions than it should. It's right?

    In time, I've been to Argentina twice, and loved your country. Great wine, beautiful land and a lovely cold weather...
     
  36. jackito

    jackito LI Guru Member

    Ok, try this. I think it will solve your problem:

    Code:
    cd /harddisk/volume_1/data/rc.d/ctorrent
    chmod 777 ctorrent
    chmod 777 dctcs
    chmod 777 libstdc++.so.5
    chmod 777 run.dctcs
    chmod 777 stop.dctcs
    
    After changing the permission of this files try to run it again. :)
    BTW you are right about 777 this is giving full permissions to everybody, but I think it not harmful in this case. Anyway you can try with 755 (only root user gets full permissions, the rest only read and execution) or even 750 (only root user gets full permissions, root group gets read+execute the rest don´t get permissions at all) if you fill more confortable with that.
     
  37. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    It solved the permissions problem! Now to another...

    It startes showing "not found" errors. I've been fixing as the appear (creating the directories, copying files to the desired location) until I've reached the port error down below.

    Almost there, almost there!

    Code:
    Enter 'help' for a list of built-in commands.
    
    $ cd /harddisk/volume_1/data/rc.d
    $ ./run.dctcs
    /bin/sh: ./run.dctcs: not found
    $ cd /ctorrent
    cd: 3: can't cd to /ctorrent
    $ cd /harddisk/volume_1/data/rc.d/ctorrent
    $ ./run.dctcs
    ./dctcs: configfile /etc/dctcs.conf: No such file or directory
    ./dctcs: torrent-directory '/harddisk/volume_1/data/rc.d/ctorrent/Torrents/': No
     such file or directory
    $ ./run.dctcs
    ./dctcs: configfile /etc/dctcs.conf: No such file or directory
    ./dctcs: configfile ./dctcs.conf: No such file or directory
    $ ./run.dctcs
    ./dctcs: download-directory '/harddisk/volume_1/data/rc.d/ctorrent/Downloads/':
    No such file or directory
    $ ./run.dctcs
    bind client port: Address already in use
    $ ./run.dctcs
    bind client port: Address already in use
    $ ./run.dctcs
    bind client port: Address already in use
    $
    ***update:seemed that it was already running.
    But when I access the web interface via http://NAS200ADDRESS:18000 and put on the login and password that I've set on the config file, it says "Authentication failed"...
     
  38. mdsilva

    mdsilva Addicted to LI Member

    I may be wrong, but it seems each time i restart the dctcs my downloads reset to 0%. Is this normal or have i broken something?
     
  39. jackito

    jackito LI Guru Member

    This message is normal at least for me and can be discarded:

    "./dctcs: configfile /etc/dctcs.conf: No such file or directory"

    About the bind error as you said is because dctcs was already running.
    In your case Juliano, based on all the permissions problems you have faced (I couldn´t reproduce them everytime time I untar the package the permissions are ok by default) my advice is to erase all traces off the package, download the tarball again and start over. Also don´t change the config file, it should work with the defaul settings. Verify that it´s working ok and then change whatever you should in the config.
     
  40. jackito

    jackito LI Guru Member

    Try to stop/kill ctorrent instead of dctcs. Every time you stop ctorrent I think is saving the status. I never tried to stop/kill dctcs.
     
  41. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    I was thinking of doing just it. I think I've done something terrible wrong when I unpacked the tarball.
    Anyway, it was good to learn how things work.
    And thanks for all your support and feedback. I'll do everything again, and post the results here.
    Thanks everybody!

    Update: Yes, it all worked like a breeze. Go figure...
    Now time to try and set the download hours, and if I feel bold enough, try to get Rsync running...
    Again, thanks everybody!

    Update 2: well, it's more difficult than I thought. mdsilva, could you explain how your scripts work?
     
  42. mdsilva

    mdsilva Addicted to LI Member

    Hi Juliano.Pita,

    When I get it working correctly I will post my scripts. Basicaly, I am trying to start ctorrent and stop ctorrent using cron.

    If I don't have a solution soon I will probably still post my scripts to get help. My current problem is that when i try to resume my downloads it resets to 0%. It seems that sometimes the .bf file disapears. Not sure why yet.
     
  43. switchy

    switchy Network Guru Member

    Hi @ all,

    sorry for my bad english, but yesterday I installed the ctorent and dctcs. Anything seems working fine, i upload the torrent on my nas200 but when i click to start the downloading, downloading not start.

    Could we help me?

    Sabina
     
  44. mdsilva

    mdsilva Addicted to LI Member

    Hi switchy,

    I suggest you look at running "ps | grep ctorrent" to see if a download has started. the web page is set to update every 15 seconds so you will have to wait.
     
  45. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Funny, I was about to post the same thing. Looks like the button is disable. The torrents doesen't start. All others buttons work (delete, etc). Maybe the web interface's start button is broken?
     
  46. jackito

    jackito LI Guru Member

    It´s working ok for me. I used dctcs for the whole weekend.
    I used the start, pause, settings hide/show buttons without any problems.
    Also the statistics are ok.

    Which state is dctcs for the torrents after you upload them?
    In my case it is taking some time before it starts downloading (searching for sources maybe?) but then is working smoothly.
     
  47. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Yes, it's after the torrent file is uploaded. It shows off in the "show stopped", and when I select it and click on "Start", nothing happens, even after a long while. Also, when I look to the status bar of my browser, I can see tha no info is being sent or received, nothing.

    Also the letter color change from white to black ehen "mouse over" is erratic.

    Just to remember, I've reinstalled the whole package after getting rid of the problematic one. This install went flawless, and I didn't even changed anything in the config file.

    If it would help, I can PM you the web address to my torrent manager.

    update: here is the font code for the "start" button

    Code:
    <td role="menuitem" id="gwt-uid-1" class="gwt-MenuItem gwt-MenuItem-disabled gwt-MenuItem-selected">⊳&nbsp;&nbsp;S<u>t</u>art</td>
    Dunno if it has any usefulness, but anyways...

    I've tried download a very popular torrent, and nothing. It stays stopped forever. It's not even looking for sources or whatever.

    Also, I've used the keyboard shortcuts (alt+t). Nothing. Used the shortcuts to everythig else (that's not greyed out) and works fine.
     
  48. mdsilva

    mdsilva Addicted to LI Member

    click start on the torrent count to 20 then in an ssh session type "ps | grep ctorrent" and show us what comes up (if anything). Also did you set a download directory in the config file?
     
  49. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Yes, I've configured the paths.
    Clicked start on a very popular torrent (22000 seeds), waite 20 secs, nothing in the web GUI.

    Here is what comes up in SSH:

    Code:
    /harddisk/volume_1/data/rc.d/ctorrent$ ps | grep ctorrent
     2200 root       3312 S   ctorrent -S localhost:15000 -e 72 -E 1.5 -C 1 /harddi
     2202 root       3588 S   ctorrent -S localhost:15000 -e 72 -E 1.5 -C 1 /harddi
     2204 root       5880 S   ctorrent -S localhost:15000 -e 72 -E 1.5 -C 1 /harddi
     2206 root       3552 D   ctorrent -S localhost:15000 -e 72 -E 1.5 -C 1 /harddi
     2275 root        400 R   grep ctorrent 
    
    Also, I've noticied that the NAS got a lot slower in reacting to ssh commands, retrieving directories, etc.

    Another question: which ports ctorrent use? I've forgot to open them in the router... from what I take, it uses port 15000. Is this right?
     
  50. mdsilva

    mdsilva Addicted to LI Member

    it seems that you are running 4 torrents? each ctorrent process is 1 torrent. You might be runing the same torrent 4 times which could be why the web gui doesn't pick it up.

    ctorent uses 18000 i think. the 15000 is internal i think.

    The reason why the nas runs slow is because you are running torrents on it.
     
  51. jackito

    jackito LI Guru Member

    DCTCS uses 18000 for the web gui and 15000 for communication with ctorrent.

    CTORRENT communicates with dctcs on port 15000 and listen for torrent clients (seeding) on port 2706 and below (every torrent you add a new port will be open, 2705, 2704 and so on) until 2106.

    On your firewall you should map a fixed range of ports to NAS200, from 2706 to 2694 for example, keeping in mind that you are going to allow only for 10 torrents to seed.

    About the performance, mdsilva is right the more torrents you add the slower NAS200 will run but you can always use renice ctorrent pids so other processes (like SAMBA, ssh, etc) can still give service. I think this is mandatory, in my case I add seven torrents to dctcs for download at the same time and that was it, NAS200 was unusable for anything else, then I reniced the priority of ctorrent to 20 (the higher the number the lower the priority) and everything was a little bit slow but at least all the services getted some CPU and they start to serve again.

    Last, as mdsilva suggest, kill all yout ctorrent processes, upload again the torrent file you want to download. Wait until it appears in dctcs, clic on it to highlight it and then clic start. Be patient, give it some time and check later to see if it is downloading.
     
  52. mdsilva

    mdsilva Addicted to LI Member

    stop all torrents script

    Hi all, I am having trouble with writing a script that stops all torrets. Below is what i've come up with so far. It works when i run it from the console(putty) but when cron calls it it doesnt seem to stop my torrents.

    Anyone got any ideas/hints/suggestions?

    Code:
    #!/bin/sh
    
    ctorrentPATH=/harddisk/volume_1/data/public/torrent/ctorrent
    
    # location of ps, grep, wc (cron may not know where to look)
    # if you have the new busybox set it to that path
    # otherwise try /bin
    # on my system i point it to the new busybox
    CMDPATH=/harddisk/volume_1/data/tools
    
    #################################################################################
    
    export PATH=$CMDPATH:$PATH
    
    echo $PATH
    uptime
    
    sleepgap=20
    
    #work in ctorrent directory
    cd $ctorrentPATH
    
    #stop all ctorrents if they are running
    if [ `ps | grep "ctorrent -S" | wc -l` -gt 1 ]; then
            echo "Send Kill Signal to all ctorrents"
            /bin/killall ctorrent 2>&1
            echo "Wait $sleepgap seconds"
            sleep $sleepgap
            if [ `ps | grep "ctorrent -S" | wc -l` -gt 1 ]; then
                    echo "Send Second Kill Signal to all ctorrents again"
                    /bin/killall ctorrent 2>&1
                    sleep $sleepgap
                    if [ `ps | grep "ctorrent -S" | wc -l` -gt 1 ]; then
                            #should never reach here
                            echo "ctorrents should not be running by now but it is for some reason"
                            /bin/killall -9 ctorrent 2>&1
                            echo "Wait $sleepgap seconds just to be safe?"
                            sleep $sleepgap
                    else
                            echo "Ctorrents killed"
                    fi
            else
                    echo "Ctorrents killed"
            fi
    else
            echo "No ctorrent clients to kill"
    fi
    
    #start dctcs if it is not running (in case it crashed. Yes it crashes every now and then)
    if [ `ps | grep dctcs | wc -l` -eq 1 ]; then
            echo "DCTCS is not running, starting now"
            ./run.dctcs
            echo "DCTCS started"
    else
            echo "DCTCS running"
    fi
    
     
  53. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Well, I've started everything fresh again: cleaned my previous ctorrent files, doenloaded the package again unpacked, etc

    Everything seemed to work ok, but...

    here is the ps | grep ctorrent command output

    Code:
    /harddisk/volume_1/data/rc.d/ctorrent$ ps | grep ctorrent
     5225 root       1404 R   ctorrent -S localhost:15000 -e 72 -E 1.5 -C 1 /harddi
     5291 root        276 R   grep ctorrent 
    
    And nothing.
    Anyway, I`m about to give up. Playing with it without enough knowledge of what`s going on can be dangerous. And I have critical data on my nas200.

    The bright side is that I`ve managed to rsync my nas properly and even used cron to schedule an automatic mirroring.

    Thanks all for your help!
     
  54. jackito

    jackito LI Guru Member

    Idea: why don´t you try to send the output of the cronjob to a file. You have a lot of usefull output messages. Then maybe you/we can find which step of the script is failing. You only need to add something like " > /harddisk/volume_1/data/tools/cronjob_output.log" to the end of the line of your cronjob that launch the script that kill the torrents. If you want to share the log file I will take a look. :)

    Suggestion: instead of this

    Code:
    if [ `ps | grep "ctorrent -S" | wc -l` -gt 1 ]; then
    You can use "pidof" (a lot more simple):

    Code:
    if [ "$(pidof ctorrent)" ];then
    Fer
     
  55. jackito

    jackito LI Guru Member

    What dctcs says? What happen if you select the torrent (mark the row) then clic the "Start" button and wait for a few minutes? Did you check that your router/firewall is not denying NAS200 access to the Internet? Did you forward the correct ports to the NAS200 on your router/firewall?

    Fer
     
  56. jackito

    jackito LI Guru Member

    I edited on of my previous posts where I wrote about the ports that ctorrent uses.
    Now the post is correct. Sorry for the inconvenience.

    Fer
     
  57. mdsilva

    mdsilva Addicted to LI Member

    Hi, how do i renice a ctorrent process? I have the new busybox installed, I just dont know how to use the renice command. Also what setting would be best so that smb doesnt get effected when i try to open the nas200 from windows?
     
  58. jackito

    jackito LI Guru Member

    Here it goes.
    1- You need to know ctorrent´s pid(s).

    Code:
    $ pidof ctorrent
    2- Then just renice them with a nice level of 20 (the higher the nice level the lower the priority -more nice with others in CPU usage-):

    Code:
    $ renice -n 20 -p ctorrent_pid_1 ctorrent_pid_2 ctorrent_pid_3
     
  59. mdsilva

    mdsilva Addicted to LI Member

    Has anyone noticed that dctcs some times gets killed when you kill a ctorrent process? anyone know how to prevent ctorrent from breaking dctcs?
     
  60. Juliano.Pita

    Juliano.Pita Addicted to LI Member

    Sorry about my absence.

    Well, I've tried again... downloaded the ctorrent full package... untared it via ssh commands... edited the config file... runned the process... acessed CTCS web interface... uploaded a torrent file. It showed up under the "stopped torrents". Highlighted it, clicked "start". Waited 2 days now... Still stopped.

    I've opened the roght ports in the router. I can access my files and ctcs web interface remotely so my router isn't denyind access to nas200 to internet.

    If someone is interested, I can PM the web path to CTCS on my nas200, for you take a look.

    Thanks, guys!
     
  61. beppes

    beppes Addicted to LI Member

    localhost problems CTCS now working

    I had problems similar to those of Juliano.Pita, I looked around and I discovered that ctorrent was not able to solve localhost, so I changed the dctcs.conf line:

    client-host=localhost:15000

    to

    client-host=192.168.1.169:15000

    where 192.168.1.169 is the fixed IP address of my Nas200 and everthing works perfectly now.

    Moreover, I discovered some things that can help:

    1) If localhos is not resolved, each press off start activates a new process...

    2) as soon as you upload a *.torrent file through the CTCS interface a new ctorrent process is automatically started (you can check that through the
    ps | grep ctorrent command)


    2) the new process looks stopped for a while because is creating the target file (-a option) that can take long time (2-3 minutes for a 700 M movie). After that it ** automatically *** moves to the download state

    *** SO you do not need to press the start button !

    In conclusion you need just to upload the *.torrent file and wait for the torrent to automatically start download

    I hope that can help
    beppes
     
  62. jackito

    jackito LI Guru Member

    Isn´t the /etc/hosts file ok by default?

    At least mine is ok. I have the entry for localhost pointing to 127.0.0.1.
    Anyway thanks for your good tips!
     
  63. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    Is it possible to nice dctcs on startup with nice? If so which commando i should use in the startup script to give the process low priority with it?
     
  64. jackito

    jackito LI Guru Member

    It´s possible but innefective since the process that consumes a lot of resources is ctorrent and not dctcs. So you need to nice every ctorrent process instead of dctcs.
    I was thinking about writing a script in order to do this, that can be executed often but I didn´t found time to do it yet.
     
  65. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    I am not capable to do that I am not so into linux to accomplish that but it would be very 'nice' to have of course so it would not slow my box down on startup
     
  66. jackito

    jackito LI Guru Member

    I wrote this script, it isn´t very sofisticated but since ash doesn´t support arrays I didn´t found the way to renice only new ctorrent processes.
    Anyway, the script works and renice a process more than once will not hurt after all.
    Feel free to use it and improve it. Of course if you do it, please share it. :)

    Code:
    #!/bin/sh
    
    export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
    
    # Script to renice our torrent downloads in order to make them nice with NAS200 limited resources
    
    # How often do we want to check if there is a new PID of ctorrent running
    CHECKINGPERIOD=90
    
    # Is there any torrent running now?
    CTPIDS=`pidof ctorrent`
    
    # Let´s start by renicing the existent torrents if there are any
    if [ "$CTPIDS" != "" ]; then
            renice -n 20 -p $CTPIDS
    fi
    
    while [ true ];
    do
            ACTCTPIDS=`pidof ctorrent`
            if [ "$ACTCTPIDS" != "$CTPIDS" ];then
                    renice -n 20 -p $ACTCTPIDS
                    CTPIDS=$ACTCTPIDS
            fi
            sleep $CHECKINGPERIOD
    done
    
    PS: the script should be send to the background since the loop of detection of new processes never ends. Also if you want to change how often the check runs, just change the "CHECKINGPERIOD" variable with the amount of seconds of your choice.
     
  67. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Instead of having a "while true"..."sleep" in your script, you might want to consider rewriting the script so it works just once, and then add it to the crontab to make it run every few minutes. That way the shell and the script won't use memory while they're sleeping and not doing anything...

    The script would look something like this (untested!):
    Code:
    #!/bin/sh
    
    # Script to renice our torrent downloads in order to make them nice
    # with NAS200 limited resources
    
    for x in $(pidof ctorrent)
    do
       renice -n 20 -p $x
    done
    
    The line that you would need to add to /etc/crontab would read something like:
    Code:
    */2 * * * * root /path/to/the/above/script &>/dev/null
    
    Don't forget to restart the crond daemon; the easiest way to do this is to run /etc/rc.d/rc.crond .

    Note that my firmware doesn't have a renice program, by the way...

    Good luck!

    ===Jac
     
  68. jackito

    jackito LI Guru Member

    That is another way. But then the user needs to remember to replace and restart the cron daemon after every reboot or write a startup script to do it. Also IMHO my script is not eating so much resources and can be used directly as a startup script. :)
    Just my two cents.
     
  69. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    Ok I've take a look at your script jackito and I have made this adjustments into it :

    Code:
    #!/bin/sh
    #
    # rc.dctcs
    
    PATH=/harddisk/volume_3/data/rc.d/busybox:/bin:/sbin:/usr/bin:/usr/sbin
    export PATH
    
    # Let's run DCTCS
    
    cd /harddisk/volume_3/data/rc.d/ctorrent
    ./run.dctcs
    
    # Do your magic on my torrent downloads in order to make them nice with NAS200 limited resources
    
    # How often do we want to check if there is a new PID of ctorrent running
    CHECKINGPERIOD=500
    
    # Is there any torrent running now?
    CTPIDS=`pidof ctorrent`
    
    # Let´s start by renicing the existent torrents if there are any
    if [ "$CTPIDS" != "" ]; then
            renice -n 20 -p $CTPIDS
    fi
    
    while [ true ];
    do
            ACTCTPIDS=`pidof ctorrent`
            if [ "$ACTCTPIDS" != "$CTPIDS" ];then
                    renice -n 20 -p $ACTCTPIDS
                    CTPIDS=$ACTCTPIDS
            fi
            sleep $CHECKINGPERIOD
    done
    
    But when i reboot my nas to test the startup script its creating a failskip file on my rc.d dir so there's something wrong with the script but i don't know what.

    The only goal for me is startup dctcs and running the renice script at boot
     
  70. jackito

    jackito LI Guru Member

    DJ, my suggestion is to start the renicing script separatelly.
    Let me show you an example:

    DCTCS startup script:

    Code:
    #!/bin/sh
    
    #code to start DCTCS
    bla bla bla bla
    
    #then, after starting DCTCS let´s launch the "renicing" script and exit
    
    /path/to/the/renicing/script/script_for_renicing.sh &
    
    
    Please note the "&" at the end of the line that launch the reinicing script. This will call the script and leave it running in the background.
    I think that your script is failing because since the last loop of the reinicing script never ends, the scripts never finish execution and probably this is making Jacs firmware think that the script is failing.
    Just my two cents. :)

    PS: actually I´m running jac4 and I´m starting dctcs and then calling the renicing script as I suggested above without any problems.
     
  71. jackito

    jackito LI Guru Member

    Hi,

    This is a new script for renicing the ctorrent processes when you add torrents to download. The difference with the previous one is that after starting, this script is ONLY renicing new ctorrent processes instead of new and previous ones (that are already reniced).
    The requirements for this script to run is to have the latest busybox version (1.14.3). You can find it here.

    Code:
    #!/bin/sh
    
    export PATH=/path/to/the/new/busybox_and_links_for_renice_and_pidof:/bin:/usr/bin:/usr/local/bin:$PATH
    
    # Script to renice our torrent downloads in order to make them nice with NAS200 limited resources
    
    # How often do we want to check if there is a new PID of ctorrent running
    CHECKINGPERIOD=90
    
    # Is there any torrent running now?
    CTPIDS=`pidof ctorrent`
    
    # Let´s start by renicing the existent torrents if there are any
    if [ "$CTPIDS" != "" ]; then
            renice -n 20 -p $CTPIDS
    fi
    
    while [ true ];
    do
            ACTCTPIDS=`pidof -o $CTPIDS ctorrent`
            if [ "$ACTCTPIDS" != "" ];then
                    renice -n 20 -p $ACTCTPIDS
                    CTPIDS=$CTPIDS" "$ACTCTPIDS
            fi
            sleep $CHECKINGPERIOD
    done
    
    Enjoy it. :cool:
     
  72. daddycaddy

    daddycaddy Networkin' Nut Member

    my torrents are not downloading

    hi there
    i installed everything exactly like you guys said
    i read all the post in this thread
    and it works
    my only problem is i cant download any torrent from isohunt
    other torrents websites works...but i wanted to use isohunt
    any ideas why?
     

Share This Page