tag:blogger.com,1999:blog-52382051589719038072024-03-13T16:06:55.205+08:00cheongseekercheongseekerhttp://www.blogger.com/profile/09602985557267765271noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5238205158971903807.post-33475968462912342282009-10-13T03:32:00.004+08:002009-10-13T03:49:31.746+08:00Problem with updateblocklist.sh script<span style="font-size:180%;"><span style="font-weight: bold;">Problem with the updateblocklist.sh script</span></span><br /><br />As indicatecd in my earlier update on 23rd September 2009, an anonymous poster had help in solving the schedule of the <span style="font-weight: bold;">editcron.sh</span> script.<br /><br />By <span style="font-size:100%;">changing it to something like "/bin/echo "0 0 * * 2 /ffp/var...." so it only runs once every Tuesday instead many, many time on Tuesday.<br /></span><span style="font-size:100%;"><br />Or, </span><span style="font-size:100%;">"/bin/echo "15 3 * * 2 /ffp/var...."</span> will mean the script to run on every Tuesday at 0315hrs.<br /><br /><span style="font-size:100%;">Or, </span><span style="font-size:100%;">"/bin/echo "0 1 * * 3 /ffp/var...."</span> will mean the script to run on every Wednesday at 0100hrs.<br /><br />Hope the above two examples will help all to understand the settings for the schedule.<br /><br />Now to the <span style="font-weight: bold;">updateblocklist.sh</span> script. The script execute with no errors when I run it in PuTTY.<br /><br />However, when I let the script run as in the schedule, the log shows the folllowing error.<br /><br /><span style="font-size:85%;"><span style="font-style: italic; color: rgb(102, 102, 102);">Starting transmission-daemon</span> <span style="font-style: italic; color: rgb(102, 102, 102);">/ffp/start/transmission.sh: line 42: su: not found</span></span><br /><br />On checking the<span style="font-weight: bold;"> transmission.sh</span> script, line 42 is<br /><br /><span style="color: rgb(102, 102, 102); font-style: italic;font-size:85%;" >run_rc_command "$1"</span><br /><br />In the beginning of the script, it is able to stop transmission by the following command.<br /><br /><span style="font-size:85%;"><span style="font-style: italic; color: rgb(102, 102, 102);">/ffp/start/transmission.sh stop<br /></span></span><br />However, at the end of the <span style="font-weight: bold;">updateblocklist.sh</span> script, the error appears. Now I have to execute this script manually.<br /><br />I hope someone will be able to help to solve this problem.<br /><br />Original script from Mike site <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br /><br /><span style="font-size:85%;"><span style="font-style: italic; color: rgb(102, 102, 102);">#!/bin/sh<br />##############################################################################<br /># ---[ updateblocklist.sh ] ---<br /># script to look update blocklist, unzip and restart transmission<br /># w 17/11/08 cheongseeker<br /># w help from horto<br /># ref charles kerr, transmission developer<br />#ref http://forum.transmissionbt.com/viewtopic.php?p=26575#p26575<br />##############################################################################<br /># define variable WGET with an absolute path<br /># define variable GUNZIP with an absoulet path<br /># define variable BLOCKLIST with an absolute path<br />WGET=/ffp/bin/wget<br />GUNZIP=/ffp/bin/gunzip<br />BLOCKLIST=/mnt/HD_a2/.transmission-daemon/blocklists/level1<br />BLOCKLISTBIN=/mnt/HD_a2/.transmission-daemon/blocklists/level1.bin<br />#stop transmission<br />/ffp/start/transmission.sh stop<br />/ffp/start/transmission.sh stop<br /><br /># check file level1.gz if exist then delete<br />if [ -f level1.gz ]; then<br />rm level1.gz<br />fi<br /><br /># check variable BLOCKLIST if exist then delete<br />if [ -f $BLOCKLIST ]; then<br />rm $BLOCKLIST<br />fi<br /><br /># check variable BLOCKLISTBIN if exist then delete<br />if [ -f $BLOCKLISTBIN ]; then<br />rm $BLOCKLISTBIN<br />fi<br /><br /># download the blocklist level1.gz from htp://download.m0k.org/transmission/files/level1.gz<br /># and save to /mnt/HD_a2/.transmission-daemon/blocklists<br />$WGET http://download.m0k.org/transmission/files/level1.gz -P /mnt/HD_a2/.transmission-daemon/blocklists<br /><br />#cd /mnt/HD_a2/.transmission-daemon/blocklists<br />cd /mnt/HD_a2/.transmission-daemon/blocklists<br /><br />#unzip level1.gz with variable GUNZIP<br />$GUNZIP level1.gz<br /><br />#restart transmission in order for transmission to recognize the new blocklists<br />/ffp/start/transmission.sh stop<br />/ffp/start/transmission.sh start<br />/ffp/start/transmission.sh start<br /></span></span>cheongseekerhttp://www.blogger.com/profile/09602985557267765271noreply@blogger.com0tag:blogger.com,1999:blog-5238205158971903807.post-56860041842938277012009-09-20T18:57:00.100+08:002010-04-25T01:28:24.634+08:00Next Step in Modding DNS-323<h1>Transmission BT for DNS-323</h1> <p><br>Firstly, I need to apologise for taking so long on posting how to have transmission running on the DNS-323. I was just too lazy in getting to it. Sorry about it.<br><br>I have to say that all the information here are taken from a lot of other users of DNS-323 whom had worked very hard at getting the most out of it. Credits all goes to them for all these information. I'm putting all these here for my own record as well as to share it with everyone.<br><br> Mike at <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br> Shadowandy at <a href="http://www.shadowandy.net/2009/01/transmission-142-for-dns-323.htm">http://www.shadowandy.net/2009/01/transmission-142-for-dns-323.htm</a><br> DSM-G600, DNS-323 and TS-I300 Hack Forum at <a href="http://forum.dsmg600.info/f3-DNS323-General-Discussion.html">http://forum.dsmg600.info/f3-DNS323-General-Discussion.html</a><br><br>However, a few good news to note. Over this long period, I'm happy to say that transmission latest version is very much improved. Now you are able to pick out individual files that are in one torrent which you want to download. It now supports DHT. All these via the web interface. Another important change, for those who are very into Internet Explorer, Transmission web interface now runs well on IE.<br><br>Now, lets get into getting transmission on your DNS-323.<br><br></p> <h6><font size="5">1. Transmission</font></h6> <p>Transmission is a light-weight BitTorrent client that, fortunately, runs on the DNS-323 devices.<br><br>Features<br> * Remote access via Web interface<br> * download of multiple torrents at once<br> * low memory imprint<br> * low CPU usage<br> * blocklist support<br> * proxy support<br><br><strong>Latest version: 1.92 (updated 21st April 2010)<br></strong><br></p> <h6><font size="5">2. Installation</font></h6> <p>IMPORTANT:<br>You need to install the latest version of ucLibc in order for Transmission to work correctly. You can find it at fonz' repository. You will require to reboot the DNS when all these are done.<br><br>Member KyleK in the DSM-G600, DNS-323 and TS-I300 Hack Forum is very helpful in compiling each latest update of transmissionbt to run on DNS-323. You can locate the latest version on this thread <a href="http://forum.dsmg600.info/viewtopic.php?id=2719&p=1">http://forum.dsmg600.info/viewtopic.php?id=2719&p=1</a>[REL] Transmission 1.3 in the forum.<br><br>Download the following files<br><br> curl-7.20.0-1.tgz from <a href="http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/All/">http://ffp.wolf-u.li/additional/net-misc/curl-7.20.0-1.tgz</a><br> uclibc-0.9.29-7.tgz from <a href="http://www.inreto.de/dns323/fun-plug/0.5/packages/">http://www.inreto.de/dns323/fun-plug/0.5/packages/</a><br><br>The latest version of Transmission is 1.92 <span style="color: rgb(255,0,0); font-weight: bold">(updated 21st April 2010)</span><br><br> Transmission-1.92-1.tgz from <a href="http://kylek.is-a-geek.org:31337/files/Transmission-1.75-1.tgz">http://kylek.is-a-geek.org:31337/files/Transmission-1.92-1.tgz</a><br><br>Refer to <a href="http://cheongseeker.blogspot.com/2008/11/modding-my-dns-323.html">http://cheongseeker.blogspot.com/2008/11/modding-my-dns-323.html</a> to find out how you can obtain the WinSCP software.<br><br>Start up WinSCP and copy curl-7.20.0-1.tgz, uclibc-0.9.29-7.tgz and Transmission-1.92-1.tgz to "/mnt/HD_a2".<br><br>Next start up PuTTY from within the WinSCP software. As PuTTY is integrated, the root user name and password will be passed over to the PuTTY software. Thus, saving you the need to re-enter them again.<br><br>You will be in the user "root" home directory. You need to change directory to "/mnt/HD_a2" by typing the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /mnt/HD_a2</span><br><br>Install the curl package by doing the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# funpkg -i curl-7.20.0-1.tgz</span><span style="color: rgb(51,102,255)">{do this only if you have not done it initially}</span><br><br>Install the uclibc package by doing the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# funpkg -i uclibc-0.9.29-7.tgz</span><span style="color: rgb(51,51,255)">{do this only if you have not done it initially}</span><br><br>If you are upgrading from an old version to the latest then do the following. I make it a habit not to delete transmission tgz file that I had copied to "/mnt/HD_a2". This helps me to find out the actual package that I had last installed. So, if you had forgotten which transmission package you installed then run the "ls" command and it will list out the files in "/mnt/HD_a2" directory.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# ls</span><br><br>Now key in the package name after "funpkg -r"<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# funpkg -r Transmission-1.22-ffp0.5.tgz</span><br><br>Then install the latest version<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# funpkg -i Transmission-1.92-1.tgz</span><br><br>Now you need to add transmission to be one of the packages that starts up automatically each time the DNS-323 starts up. Type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# chmod a+x /ffp/start/transmission.sh;sh /ffp/start/transmission.sh start</span><br><br>You will see a message that state transmission is starting. Now we have to stop transmission again to continue with the rest of the set up. Type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# sh /ffp/start/transmission.sh stop </span><br><br>You can check the status to see if transmission is still running. Type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# sh /ffp/start/transmission.sh status</span><br><br><span style="color: rgb(255,102,102)">* * Before you proceed to the following steps you need to make sure that Transmission is not running as you will be editing the "settings.json" file.</span><br><br></p> <h6><font size="5">3. Whitelisting and Unmasking</font></h6> <p>* * Note:<br>Whitelisting is to control unwanted access to your DNS. If you wish to access your DNS, to get to the transmission web interface from outside of your house via the internet, then you will need to turn on "rpc-authentication-required" to "true" and set the username and password. This will require you to key in username and password each time you access the transmission web interface, even from within your home. Then it will be better for you to turn off "rpc-whitelist-enabled", changing it from "true" to "false".<br><br>The following will detail how to set the whitelisting for those who are still interested. Now we need to edit the configuration file "settings.json" located at "/mnt/HD_a2/.transmission-daemon" directory<br><br>First is to add your local LAN IP range to the whitelist. Let's assume that your local LAN range is 192.168.x.x then we need to add 192.168.*.* to whitelist the whole range.<br><br>In PuTTY, type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# vi /mnt/HD_a2/.transmission-daemon/settings.json</span><br><br>Move the cursor to the line "rpc-whitelist": "127.0.0.1",<br><br>Move the cursor the the end of "127.0.0.1". Make sure that your cursor is placed after the "1" character.<br><br>You will notice the bottom left hand corner of the window there is a "-" character. When you hit the "i" key, it will change from "-" to "I". When you hit the "i" key again, it changes back to "-". Now, ensure that the bottom left corner character is "I" then type "192.168.*.*". The line should shows like this.<br><br> "rpc-whitelist": "127.0.0.1,192.168.*.*",<br><br>Now hit the "<esc>" key then ":" key. The bottom left hand character will change to ":". Then hit "w" key, follow immediately by "q" key then hit the "enter" key. This will save the file and return you to the prompt.<br><br>Alternatively if you use WinSCP, navigate your way to "/mnt/HD_a2/.transmission-daemon" and locate "settings.json". Double click on the file and script editor will open the file. You can edit the necessary change and click "Save" and then "Exit"<br><br></p> <h6><font size="5">Unmasking</font></h6> <p>Edit: 21st April 2010<br><br>Next do the following as adviced by Isildur on the DSM-G600, DNS-323 and NSA-220 Hack Forum thread <a href="http://forum.dsmg600.info/viewtopic.php?pid=35187#p35187">DNS-323/321 Discussion>>[REL] Transmission 1.3 post #984</a><br><br>Use WinSCP, navigate your way to "/mnt/HD_a2/.transmission-daemon" and locate "settings.json". Double click on the file and script editor will open the file.<br><br>Locate "unmask" and change the value from "18" to "0" then click "Save" and then "Exit".<br><br></p> <h6><font size="5">4. Blocklist</font></h6> <p>Next is to turn on blocklist.<br><br>IP blocking/blocklisting is simply a technique used to restrict (block) traffic from any computer that is within a set list or parameters of any given IP range.<br><br>While IP Blocking hardly makes oneself anonymous, it can significantly reduce your chances of being tracked by bad groups interested in what you’re doing with your bandwidth. And by no means do blocklists offer 100% effectiveness for file sharing protection. However, when used in conjunction with a proxy server, it can reduce your odds of being caught down to nearly zero.<br><br>Transmission does have blocklisting and uses the list from bluetack. You have to manually download the blocklist file "level1" from Bluetack. You just need to do this once a week.<br><br>In PuTTY, type the following<br><br><span style="color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# vi /mnt/HD_a2/.transmission-daemon/settings.json</span><br><br>Move the cursor to the line "blocklist-enabled": false, change false to true<br><br>Now hit the "esc" key then ":" key. The bottom left hand character will change to ":". Then hit "w" key follow immediately by "q" key then hit "enter" key. This will save the file and return you to the prompt.<br><br>Alternatively if you use WinSCP, navigate your way to "/mnt/HD_a2/.transmission-daemon" and locate "settings.json". Double click on the file and script editor will open the file. You can edit the necessary change and click "Save" and then "Exit".<br><br>Lower down the post, I will show you a script which you can execute to do the downloading of the "level1" file.<br><br></p> <h6><font size="5">5. Encryption</font></h6> <p>Encrypting your torrents will prevent throttling ISP’s from shaping your traffic. The RC4 encryption obfuscates not only the header but the entire stream. This means that it’s very hard for your ISP to detect that the traffic you are generating comes from BitTorrent.<br><br>Now to turn on encryption. In PuTTY type the following.<br><br><span style="color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# vi /mnt/HD_a2/.transmission-daemon/settings.json </span><br><br>Move the cursor to the line "encryption". Change the number to "2".<br><br>Now hit the "esc" key then ":" key. The bottom left hand character will change to ":". Then hit "w" key follow immediately by "q" key then hit "ente" key. This will save the file and return you to the prompt<br><br>Alternatively if you use WinSCP, navigate your way to "/mnt/HD_a2/.transmission-daemon" and locate "settings.json". Double click on the file and script editor will open the file. You can edit the necessary change and click "Save" and then "Exit"<br><br></p> <h6><font size="5">6. Setting the downloading directory</font></h6> <p>Next is to set up the directory where your torrent files will be downloading to. The following will create a "incoming" directory under "/mnt/HD_a2".<br><br>In PuTTY, do the following.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /mnt/HD_a2<br> root@YourDNS:/mnt/HD_a2# mkdir incoming<br> root@YourDNS:/mnt/HD_a2# chown nobody:777 incoming<br> root@YourDNS:/mnt/HD_a2# chmod 777 /mnt/HD_a2/incoming<br> root@YourDNS:/mnt/HD_a2# reboot</span><br><br>* * Note that chmod 777 allows all user to execute files in this directory. This is to help with those that has the "Permission Denied" problem.<br><br>The DNS-323 will reboot. After the DNS-323 blue light has stopped blinking, type the following in your web browser<br><br><span style="color: rgb(102,102,102)"> <a href="http://192.168.2.101:9091">http://192.168.2.101:9091</a></span><br><br>Click on the little icon at the bottom left hand corner, then select "Preference". In the location "Download to:", key in "/mnt/HD_a2/incoming".<br><br>In the section "Encryption:", ensure that "Ignore unencrypted peers" is ticked.<br><br>In the section "Limit total bandwidth:", tick "Upload Rate:" and key in the value "22".<br><br>Then click "Save".<br><br>In PuTTY, do the following.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# /ffp/start/transmission.sh stop</span><br><br>You can check the status to see if transmission is still running. Type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# /ffp/start/transmission.sh status </span><br><br><span style="color: rgb(255,102,102)">* * Before you proceed to the following steps you need to make sure that Transmission is not running as you will be editing the "settings.json" file.</span><br><br></p> <h6><font size="5">7. Moving completed torrents</font></h6> <p>There is a function in transmission that is not turn on by default.<br><br>In PuTTY, type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# vi /mnt/HD_a2/.transmission-daemon/settings.json </span><br><br>Move the cursor to the line "incomplete-dir-enabled": false,<br><br>Change "false" to "true".<br><br>Now hit the "esc" key then ":" key. The bottom left hand character will change to ":". Then hit "w" key follow immediately by "q" key then hit "enter" key. This will save the file and return you to the prompt<br><br>Alternatively if you use WinSCP, navigate your way to "/mnt/HD_a2/.transmission-daemon" and locate "settings.json". Double click on the file and script editor will open the file. You can edit the necessary change and click "Save" and then "Exit".<br><br>One line above this is the folder set for "incomplete-dir". It is set to "/mnt/HD_a2/.transmission-daemon/Incomplete".<br><br>In PuTTY, do the following.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /mnt/HD_a2/.transmission-daemon<br> root@YourDNS:/mnt/HD_a2/.transmssion-daemon# mkdir Incomplete<br> root@YourDNS:/mnt/HD_a2/.transmssion-daemon# chown nobody:777 Incomplete<br> root@YourDNS:/mnt/HD_a2/.transmssion-daemon# chmod 777 /mnt/HD_a2/.transmission-daemon/Incomplete </span><br><br>By doing this, when you first upload a torrent file to Transmission, it will be stored at "/mnt/HD_a2/.transmission-daemon/Incomplete". During the full duration of downloading the file will continue to reside here.<br><br>Upon completion of download, Transmission will automatically move the file from "/mnt/HD_a2/.transmission-daemon/Incomplete" folder to the "Download to:" folder which you set in Step 6 above. In this above example it is "/mnt/HD_a2/incoming".<br><br></p> <h6><font size="5">8. Login credentials for transmission web interface</font></h6> <p>To set up login credentials you need to start the transmission daemon at least once from the command-line.<br><br>Before doing this, you will need to stop transmission from running. Do the following via PuTTY.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# sh /ffp/start/transmission.sh stop</span><br><br>You can check the status to see if transmission is still running. Type the following<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# sh /ffp/start/transmission.sh status</span><br><br>Next do the following.{adviced by Kylek on the DSM-G600, DNS-323 and NSA-220 Hack Forum thread <a href="http://forum.dsmg600.info/viewtopic.php?pid=35855#p35855">DNS-323/321 Discussion>>[REL] Transmission 1.3 post #1079</a><br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# su nobody -c "transmission-daemon -f -g /mnt/HD_a2/.transmission-daemon -t -u [username] -v [password] -a 127.0.0.1,192.168.*.*"</span><br><br>You should see some text about Transmission starting. If there are no error messages, you can quit Transmission by pressing Ctrl-C. You will need to reboot the DNS<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# reboot</span><br><br>The DNS-323 will reboot. After the DNS-323 blue light has stopped blinking, type the following in your web browser<br><br><span style="color: rgb(102,102,102)"> http://192.168.2.101:9091</span><br><br>You will be prompted to key in the username and password.<br><br></p> <h6><font size="5">9. Scripting</font></h6> <p>Now we are have to prepare a few scripts which will help with the running of transmission. All scripts below are the hard work of mike. His website is <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br><br>He has helped me a lot with the setting up of transmission running on DNS-323 especially on the scripting.<br><br><span style="font-weight: bold"> torrentwatchdog.sh</span> - This script will scan "/mnt/HD_a2/torrents" directory for any new *.torrents files. When it finds it, the torrent file will be added and queue up. <br><br>The second part of the script scan all current downloading torrents, when it finds completed torrents that are seeding, it will stop it. For those that had enable login credentials, your usename and password will have to be in the script.<br><br><span style="font-weight: bold"> updateblocklist.sh</span> - This script will check for existing blocklist file and delete it. Then it will go fetch the latest level1 file, unzip and restart transmission again.<br><br><span style="font-weight: bold"> editcron.sh</span> - This script is to automate the above two scripts.<br></p> <p> </p> <h6><font size="5">10. torrentwatchdog script</font></h6> <p>First we have to create the torrent directory which you will save all *.torrents files. Do the following via PuTTY.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /mnt/HD_a2<br> root@YourDNS:/mnt/HD_a2# mkdir torrents<br> root@YourDNS:/mnt/HD_a2# chown nobody:777 torrents<br> root@YourDNS:/mnt/HD_a2# chmod 777 /mnt/HD_a2/torrents<br><br> root@YourDNS:/mnt/HD_a2# mkdir logs<br> root@YourDNS:/mnt/HD_a2# chown nobody:777 logs<br> root@YourDNS:/mnt/HD_a2# chmod 777 /mnt/HD_a2/logs</span><br><br>Next to create the scripts directory where all the scripts will be kept.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2# cd /ffp/var<br> root@YourDNS:/mnt/HD_a2/ffp/var# mkdir scripts<br> root@YourDNS:/mnt/HD_a2/ffp/var# chown nobody:777 scripts<br> root@YourDNS:/mnt/HD_a2/ffp/var# chmod 777 /ffp/var/scripts</span><br><br>In the WinSCP software, on the right pane, navigate to "/ffp/var/scripts". Ensure that the right pane is selected, then hit "Shift" + "F4" together. In the dialog box that is asking for a new file name, enter "torrentwatchdog.sh" and hit "Ok".<br><br>The text editor window appear. Copy the following script and paste into the text editor window. Take note that you will need to replace <username>and <password>with your own login credentials.<br><span style="font-style: italic; color: rgb(102,102,102); font-size: 85%"><br>#!/bin/sh<br>###########################################################################<br># script to monitor a selection of directories for new .torrent files.<br># if found, queue them up in transmission <br># and when done downloading, pause the torrent <br># w 10/20/08 horto<br># u 10/29/08 horto - implmented "make transmission stop after seeding 1:1"<br># u 10/29/08 horto - v2.0, do away with /torrents and /incoming dirs, and<br># just monitor /media/movies, /media/TV and /media/mp3<br># directories for torrents so I don't have to manually<br># organize everything later!<br># u 11/06/08 horto - fixed bug with awk not being found via cron<br>###########################################################################<br>TORRENTDIRS="/mnt/HD_a2/incoming"<br>LOG=/mnt/HD_a2/logs/torrentwd.log<br>TRANSMISSION_REMOTE="/ffp/bin/transmission-remote -n username:password"<br><br># check each incoming TORRENTDIR for new .torrents<br>for DIR in $TORRENTDIRS; do<br>for FILE in $DIR/*.torrent; do<br><br># set download dir to current working dir<br>$TRANSMISSION_REMOTE -w $DIR<br><br># pick out .torrent files and queue them up<br>if [ "$FILE" != "$DIR/*.torrent" ]; then<br>echo [`date`] "$FILE" added to queue. >> $LOG<br>$TRANSMISSION_REMOTE -a "$FILE"<br>rm "$FILE"<br>echo [`date`] "$FILE" deleted. >> $LOG<br>sleep 1<br>fi<br>done<br>done<br><br># stop completed downloads<br>for i in `/ffp/bin/transmission-remote -l -n username:password | grep Done | grep Seeding | grep -v Ratio | /ffp/bin/awk '{print $1}'"`; do<br>echo [`date`] stopping torrent id $i >> $LOG<br>$TRANSMISSION_REMOTE -t $i -S<br>done<br><br>exit 0<br></span><br><br>Click on the "Save" icon and then click on the "Close Editor" icon.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /ffp/var/scripts</span><br><span style="color: rgb(255,0,0); font-weight: bold"><br>Edit: 05th November 2009</span><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/mnt/HD_a2/ffp/var/scripts# chmod a+x /ffp/var/scripts/torrentwatchdog.sh;sh /ffp/var/scripts/torrentwatchdog.sh</span><br><br>In the WinSCP software, on the right pane, navigate to "/mnt/HD_a2/logs". Ensure that the right pane is selected, then hit "Shift" + "F4" together. In the dialog box that is asking for a new file name, enter ".torrentwd.log" and hit "Ok".<br><br>The text editor window appear.<br><br>I do not find watching the torrents directory that useful. The reason is that I had set up my DNS to be accessible from outside my home via the internet. In this manner, I'm able to start any *.torrent file at any time, any where. However, the second part of the script is very useful as it will stop the torrent that has finished downloading.<br><br>Thus, I still keep this script running. Later on you will find out how to schedule to run this script at a scheduled interval. I have set it to run every hour.<br><br></p> <h6><font size="5">11. Updating of Blocklist file</font></h6> <p>As mentioned earlier, blocklist is simply a technique used to restrict (block) traffic from any computer that is within a set list or parameters of any given IP range.<br><br>While IP Blocking hardly makes oneself anonymous, it can significantly reduce your chances of being tracked by bad groups interested in what you’re doing with your bandwidth. And by no means do blocklists offer 100% effectiveness for file sharing protection. However, when used in conjunction with a proxy server, it can reduce your odds of being caught down to nearly zero.<br><br>In the WinSCP software, on the right pane, navigate to "/ffp/var/scripts". Ensure that the right pane is selected, then hit "Shift" + "F4" together. In the dialog box that is asking for a new file name, enter "updateblocklist.sh" and hit "Ok".<br><br>The text editor window appear. Copy the following script and paste into the text editor window.<br><br>Original script from Mike site <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br><br><span style="font-style: italic; color: rgb(102,102,102); font-size: 85%"><br>#!/bin/sh<br>##############################################################################<br># ---[ updateblocklist.sh ] ---<br># script to look update blocklist, unzip and restart transmission<br># w 17/11/08 cheongseeker<br># w help from horto<br># ref charles kerr, transmission developer<br>#ref http://forum.transmissionbt.com/viewtopic.php?p=26575#p26575<br>##############################################################################<br># define variable WGET with an absolute path<br># define variable GUNZIP with an absoulet path<br># define variable BLOCKLIST with an absolute path<br>WGET=/ffp/bin/wget<br>GUNZIP=/ffp/bin/gunzip<br>BLOCKLIST=/mnt/HD_a2/.transmission-daemon/blocklists/level1<br><br># check variable BLOCKLIST<br>if [ -f $BLOCKLIST ]; then<br>mv $BLOCKLIST $BLOCKLIST.bak<br>fi<br><br># download the blocklist level1.gz from htp://download.m0k.org/transmission/files/level1.gz <br># and save to /mnt/HD_a2/.transmission-daemon/blocklists<br>$WGET http://download.m0k.org/transmission/files/level1.gz -P /mnt/HD_a2/.transmission-daemon/blocklists<br><br>#cd /mnt/HD_a2/.transmission-daemon/blocklists<br>cd /mnt/HD_a2/.transmission-daemon/blocklists<br><br>#unzip level1.gz with variable GUNZIP<br>$GUNZIP level1.gz<br><br>#restart transmission in order for transmission to recognize the new blocklists<br>/ffp/start/transmission.sh stop<br>/ffp/start/transmission.sh start<br></span><br><br>Click on the "Save" icon and then click on the "Close Editor" icon.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /ffp/var/scripts {can skip this}<br> root@YourDNS:/mnt/HD_a2/ffp/var/scripts# chmod +x updateblocklist.sh {can skip this} </span><br><br>This script will first check for existing "level1" and "level1.bin" files in the "/mnt/HD_a2/.transmission-daemon/blocklists" directory. If both files exists, they are deleted. Transmission is then stopped.<br><br>Next it goes to "http://download.m0k.org/transmission/files/level1.gz" and download "level1.gz" to "/mnt/HD_a2/.transmission-daemon/blocklists" directory. After download, it will unzip the "level1.gz" file.<br><br>Lastly, transmission is restarted.<br><br><span style="color: rgb(255,0,0); font-weight: bold">Edit - 22/09/2009</span> : I encountered some problem with this script. When executed locally via PuTTY, the script runs without any problem. However, when it is set to run on a schedule of every Tuesday, it does not execute properly<br><br></p> <h6><font size="5">12. Automate scripts</font></h6> <p>Having finish both scripts, now is to have both scripts run at certain interval.<br><br>In the WinSCP software, on the right pane, navigate to "/ffp/start". Ensure that the right pane is selected, then hit "Shift" + "F4" together. In the dialog box that is asking for a new file name, enter "editcron.sh" and hit "Ok".<br><br>The text editor window appear. Copy the following script and paste into the text editor window.<br><br>Original script from Mike site <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br><br><span style="font-style: italic; color: rgb(102,102,102); font-size: 85%"><br>#!/bin/sh<br>##############################################################################<br># ----[ editcron.sh ]----<br># script to keep cronjobs persistent (e.g. after reboot)<br># NOTE: put this in /mnt/HD_a2/ffp/start/ and make it executable.<br># w 22/10/08 horto <br># ref/credit: http://tinyurl.com/5m2349 - thanks chumby!<br>#############################################################################<br>FFP=/mnt/HD_a2/ffp<br>CRONTXT=$FFP/etc/crontab.txt<br><br># start with existing crontab<br># note: on a fresh reboot, this will always have been reset to standard<br>/bin/crontab -l > $CRONTXT<br><br># add cronjobs here preceeded by /bin/echo. <br># don't forget to enclose them in double quotes.<br>/bin/echo "0 * * * * /ffp/var/scripts/torrentwatchdog.sh >> /mnt/HD_a2/logs/torrentwd.log 2>&1" >> $CRONTXT<br>/bin/echo "30 3 * * * /ffp/var/scripts/unpacker.sh >> /mnt/HD_a2/logs/unpack.log 2>&1" >> $CRONTXT<br><br># install the new crontab<br>/bin/crontab $CRONTXT<br><br># clean up<br>/bin/rm $CRONTXT<br></span><br><br>Note: The following explain how to set the interval. Feel free to change it.<br><br>* * * * * - means minutes, hours, day, month, weekday<br>Thus, "0 * * * *" means it runs every hour at the top of the hour<br><br>Go back to the PuTTY window and add editcron.sh to the list of packages that will start each time the DNS starts up.<br><br><span style="color: rgb(255,0,0); font-weight: bold">Edit: 23rd September 2009</span> - An anonymous poster put up an comment on this blog. This person commented on the following.<br><br>For "/bin/echo "* * * * 2 /ffp/var/scripts/updateblocklist.sh >> /mnt/HD_a2/logs/updateblocklist.log 2>&1" >> $CRONTXT"<br><br>You may want to change it to something like "/bin/echo "0 0 * * 2 /ffp/var...." so it only runs once every Tuesday instead many, many time on Tuesday.<br><br>I found this site which explains the scheduling in detail. <a href="http://www.developerspot.com/print/php/unix-webserver-crontab-basics/">http://www.developerspot.com/print/php/unix-webserver-crontab-basics/</a><br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:~# cd /ffp/start</span><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/ffp/start# chmod a+x editcron.sh</span><br><br>Now you need to test it.<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/ffp/start# crontab -l</span> {This should list existing crontab, without torrentwatchdog.sh and updateblocklist.sh}<br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/ffp/start# ./editcron.sh</span><br><br><span style="font-style: italic; color: rgb(153,51,153)"> root@YourDNS:/ffp/start# crontab -l</span> {This should now list crontab with torrentwatchdog.sh and updateblocklist.sh}<br></p> <h6><font size="5"></font> </h6> <h6><font size="5">13. Making DNS available outside of your home</font></h6> <p>Most router nowadays has the DDNS option built in. All you need to do is to enable this function in your router. Subscribe to the DDNS service. Next, most importantly, you need to open port 9091 on your router. From outside of your home, activate your broswer and point to your DDNS address.<br><br>Example: <span style="font-style: italic">http://outsideyourhome.dyndns.org:9091</span><br><br>Now you are able to access your transmission from anywhere.<br><br></p> <h6><font size="5">14. Conclusion</font></h6> <p>Finally, after doing all of the above you should have your DNS running Transmission bit torrent client which requires you to input your username and password. You will be able to access your transmission web interface from anywhere, as long as you have an internet connection. This allows you to check up on the progress of your torrents downloading and to start new torrent as you are able to upload the torrent filt via the transmission web interface. Your transmission is enable with encryption and blocklisting which helps in the bittorent performance.<br><br>Lastly, the updateblocklist script will update the blocklist automatically each first day of the week. The torrentwatchdog script will check for finished torrents and stop it. This script runs once every hour.<br><br>Enjoy your DNS.</p> cheongseekerhttp://www.blogger.com/profile/09602985557267765271noreply@blogger.com2tag:blogger.com,1999:blog-5238205158971903807.post-59516441891461218162008-11-12T16:05:00.004+08:002009-09-19T23:55:08.509+08:00Modding my DNS-323<span style="font-size:180%;"><span style="font-weight: bold;"></span></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidT9y8gXQKs9DuErbY1Bg7m5IhYvlSq3y3wcUteZpyurvL3JnLI2KmV1uYvURMM-19kxqmnL5hBjWvM1_JBvckmujMKd0eDQ6QWaFrVTFc-TOTpXCEk9Y7RSvTQbJsyHdWOPRC3tveDlI/s1600-h/dns-323.jpeg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 149px; height: 147px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidT9y8gXQKs9DuErbY1Bg7m5IhYvlSq3y3wcUteZpyurvL3JnLI2KmV1uYvURMM-19kxqmnL5hBjWvM1_JBvckmujMKd0eDQ6QWaFrVTFc-TOTpXCEk9Y7RSvTQbJsyHdWOPRC3tveDlI/s320/dns-323.jpeg" alt="" id="BLOGGER_PHOTO_ID_5267681130595396370" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCSVuD-zIU5XtN60PE8ITE6jVPJTrqa0UPjiuxIS_cnZ_eGX6evUSRMm6IumfRT0_eJsWesAJZ6KzkBVUmEYKDirjreTt7EHPIgKiSYQ7HDNTfs6KTU8s6bOh50Q-8sirIk9ywU8A67z0/s1600-h/dns-323+back.jpeg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 110px; height: 144px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCSVuD-zIU5XtN60PE8ITE6jVPJTrqa0UPjiuxIS_cnZ_eGX6evUSRMm6IumfRT0_eJsWesAJZ6KzkBVUmEYKDirjreTt7EHPIgKiSYQ7HDNTfs6KTU8s6bOh50Q-8sirIk9ywU8A67z0/s320/dns-323+back.jpeg" alt="" id="BLOGGER_PHOTO_ID_5267681133651628146" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6HhIkLnjcv43QAZ91Z8g1l6a-G2ABrEiMiatKtPLtcqs2mErXA61U57Ew6E1rKA2U73HKX4Q-qi8wl-9OqD9VUE8Y77BuZ0_bh7_uFn0lhpusGcLnb_E_P_zZdoNtmWqtDGZqpdbejp8/s1600-h/dns-323+inside.jpeg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 118px; height: 89px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6HhIkLnjcv43QAZ91Z8g1l6a-G2ABrEiMiatKtPLtcqs2mErXA61U57Ew6E1rKA2U73HKX4Q-qi8wl-9OqD9VUE8Y77BuZ0_bh7_uFn0lhpusGcLnb_E_P_zZdoNtmWqtDGZqpdbejp8/s320/dns-323+inside.jpeg" alt="" id="BLOGGER_PHOTO_ID_5267681139068777026" border="0" /></a><span style="font-size:100%;"><br /></span><span style="font-size:100%;"><br />Since having bought the DNS-323 I have reading all information that I can find on how to mod the DNS-323.<br /><br />I found much information from <a href="http://forum.dsmg600.info/f3-DNS-323-General-Discussion.html">http://forum.dsmg600.info/f3-DNS-323-General-Discussion.html</a> forum. This forum is dedicated on modding of the DNS-323.<br /><br />I also found another blogger that has posted a very good guide on modding of the DNS-323. His blog can be found at <a href="http://www.horto.ca/?p=10">http://www.horto.ca/?p=10</a><br /><br />I'm putting up my version of the guide as a reference for myself should I need to re-do my NAS again. I'm a newbie when it comes to unix thus the need to document all this down.<br /><br /><span style="font-size:130%;"><span style="font-weight: bold;"><span style="font-size:180%;">1. First step is to install Fonz fun-plug0.5<br /></span><span style="font-size:100%;"><br /></span></span></span></span>The first thing that you need to do is to download Fonz fun-plug0.5 from <a href="http://www.inreto.de/dns323/fun-plug/0.5/">http://www.inreto.de/dns323/fun-plug/0.5/<br /></a><br />The files to download are<br /><ol><li>fun_plug<br /></li><li>fun_plug.tgz</li></ol>After having downloaded the two files, open "My Network Places" and access the DNS-323 Volume_1 by typing the following<br /><br /><div style="text-align: center;">\\(IP address of the DNS-323)\Volume_1<br /></div><br />If you do not know how to find out the IP address of your DNS-323, Dlink does provide a software call "Easy Search Utility". If you cannot find the original disc that came with your NAS, you can download the software by going to Dlink website.<br /><br /><br />Copy<br /><ol><li>fun_plug</li><li>fun_plug.tgz </li></ol>to<br /><div style="text-align: center;">\\(IP address of the DNS-323)\Volume_1<br /><br /></div>Reboot the DNS-323 and wait for it to come online. Fonz fun-plug should auto-install itself.<br /><br />Once the fun-plug has been installed, you will be able to Telnet to your NAS.<br /><br /><span style="font-size:180%;"><span style="font-weight: bold;">2. Setting up Telnet on the DNS-323</span><br /></span><br />Click on "Start", "run" and type in "cmd". The command prompt window will open. In the command prompt window type "telnet (IP address of the DNS-323)"<br /><br />You will see a "/# " prompt. It mean you have successfully telnet to the device.<br /><br />The firmware comes with a disabled root account that cannot login the normal way. This is the reason funplug starts an open telnet server that circumvent the normal login procedure to provide a root shell directly.<br /><br />To fix this , you should run pwconv to update /etc/shadow, set a password and change the shell.<br /><br /><div style="text-align: left;">/# pwconv<br />/# passwd<br />/# usermod -s /ffp/bin/sh root</div><br />If you omit the usermod command, login will start the shell configured for user 'root' in /etc/passwd. Before saving your changes, you should run additional checks on the password and group files. Some firmware versions duplicate the ftp user and now is a good time to fix this.<br /><br />/# pwck<br />/# grpck<br /><br />You may ignore the warnings about missing home directories and invalid group names.<br /><br />If you are asked to remove a duplicate user, say 'yes' to remove one of them. Rerun the commands to check that it is fixed.<br /><br />Test the changes with the login program by typing<br /><br />/#login<br /><br />type in 'root' then the password that you had created.<br /><br />If you are successful in logging in then you will need to save the password files to the flash memory by typing the following<br /><br />root@example:~# store-passwd.sh<br />Copying files to mtd1…<br />Copying files to mtd2…<br />Done.<br /><br /><span style="font-size:180%;"><span style="font-weight: bold;">3. Disable telnet and enable ssh for better secure communication.</span><br /></span><br />Having successfully enable login with user 'root' and password, you will want to enable ssh for better secure communication.<br /><br />Enable ssh permanently with the following steps via telnet<br /><br />First telnet to your DNS-323. After successful login, do the following.<br /><br />/# cd /ffp/start<br />/ffp/start/# chmod a-x telnetd.sh <span style="color: rgb(51, 102, 255);font-size:85%;" ><span style="font-style: italic;">{this command disable telnet and stops it from starting}</span></span><br />/ffp/start/# chmod a+x sshd.sh <span style="color: rgb(51, 102, 255);font-size:85%;" ><span style="font-style: italic;">{this command enable ssh to start automatically and able to execute manually}</span></span><br /><br />I use PuTTY for connecting via ssh to the DNS-323. It is a freeware and you can download it at <a href="http://www.putty.org/">http://www.putty.org/</a><br /><br />Alternatively, another popular option is to use WinSCP. WinSCP is an open source free SFTP client and FTP client for Windows. Legacy SCP protocol is also supported. Its main function is safe copying of files between a local and a remote computer. It has PuTTY integrated which makes it convenient to use it when you need it.<br /><br />WinSCP is very easy to use and let you copy files from your computer to the DNS-323 easily.<br /><br />You can download a portable version from <a href="http://portableapps.com/apps/internet/winscp_portable">http://portableapps.com/apps/internet/winscp_portable</a><br /><br />Next will be installing Transmission, a free and easy bittorrent client. You can find out more at <a href="http://www.transmissionbt.com/">http://www.transmissionbt.com/</a>cheongseekerhttp://www.blogger.com/profile/09602985557267765271noreply@blogger.com0