DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#26 2008-12-03 11:21:35

BishopPell
Member
Registered: 2008-11-16
Posts: 10

Re: Transmission added functionality util script.

Also the /ffp/var/log/trans_utils.sh.log is where the logging for /ffp/start/trans_util_control.sh is directed to.

Offline

 

#27 2008-12-03 13:09:11

BishopPell
Member
Registered: 2008-11-16
Posts: 10

Re: Transmission added functionality util script.

For convenience I uploaded a new version that includes most of DFreeze changes but keeps the rest of the script (especially the directories the same).  I did not enable the Uploading / Seeding as active connections however.  I updated my original posting with the new filename, but in case you can't be bothered:

wget http://pellcorp.com/dns323/trans14_utils.tar.gz
tar -zxvf trans14_utils.tar.gz -C /

This script does require /ffp/start/syslog.sh to be active to get the logs.  For the moment they are being sent to /var/log/messages and RimBlock is correct in that you will lose any logs if you restart.  What I have done in the past (and it kind of works) is on startup delete the /var/log/messages and create a soft link to /ffp/var/log/messages instead.

It works until the /var/log/messages rolls over.

Potentially you might be able to completely remove the /var/log/ directory on startup and create a soft link to /ffp/var/log/ - but I have not tried that.

Offline

 

#28 2008-12-03 13:22:46

BishopPell
Member
Registered: 2008-11-16
Posts: 10

Re: Transmission added functionality util script.

I just tried it myself, changed the /ffp/start/syslogd.sh, seems to work quite well.  I added the following to the start of the syslogd_start()
function:

    rm -r /var/log                               
    ln -s /ffp/var/log/ /var/log             


So it now looks like:

syslogd_start()
{
    rm -r /var/log
    ln -s /ffp/var/log/ /var/log

    proc_start /ffp/sbin/syslogd /ffp/sbin/klogd
}

WARNING - I DON'T TRULY UNDERSTAND THE IMPACT OF DOING THIS SO BE CAREFUL!!!!!

Offline

 

#29 2008-12-03 13:37:21

BishopPell
Member
Registered: 2008-11-16
Posts: 10

Re: Transmission added functionality util script.

WARNING - I DON'T TRULY UNDERSTAND THE IMPACT OF DOING THIS SO BE CAREFUL!!!!!

A couple of extra things I did once off (not sure any of it was necessary other than lastlog, wtmp and btmp).

cp -r /var/log/samba /ffp/var/log
cp -r /var/log/glusterfs /ffp/var/log
cp -r /var/log/cores /ffp/var/log
cp /var/log/lastlog /ffp/var/log
cp /var/log/wtmp /ffp/var/wtmp
cp /var/log/btmp /ffp/var/btmp

I only had to do this once to quiet some errors in /ffp/var/log/messages

I don't believe /var/log/messages gets written to without syslog, so no need to do anything with that, can just append to /ffp/var/log/ one once you remove /var/log and create soft link.

Cheers
Jason

Offline

 

#30 2008-12-08 16:14:03

headman
Member
Registered: 2008-03-09
Posts: 17

Re: Transmission added functionality util script.

Well done! Everything seems to be working here and logs are working too!

Offline

 

#31 2008-12-09 10:36:21

Nuri
Member
Registered: 2008-09-27
Posts: 12

Re: Transmission added functionality util script.

It`s possible to rewrite this useful script without using bash? I have not bash installed and don`t plan to. Please smile

Offline

 

#32 2008-12-17 09:11:03

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Hi Nuri,

Someone is welcome to try but one of the advantages of Bash is its ability to use arrays.  Bourne shell (sh) does not have this functionality built in and so it makes managing lists of items (i.e. torrent file names) where there can be a wide range of characters / spaces etc quite tricky.

It would be a fair amout of work to do.

Any reason you are not wishing to add bash ?

Oh and unfortunately it looks like one of my drive has failed with the last overheating crash so I have not been able to get my DNS-323 up and running again yet.

Regards
RB

Offline

 

#33 2008-12-19 04:23:58

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Well with two days leave and having to sit at home I have got my DNS 323 working again (although one drive is reporting io errors on copying files across)

I have therefore spent most of yesterday updating the script to work with Transmission 1.40+ and doing some testing.

There are a few original bugs removed, probabily a few new ones added :-).

The script installs in to the .transmission-daemon set of directories.
scripts - main script
logs - script logs
archive - archiving .torrent files (not yet implemented)
working - transmission working directory to help split the running and completed torrents.

There are two directories on the main share point (usually /mnt/HD_a2).
completed - For all completed and seeded to specified ratio torrents.
watch - location for new .torrent files and for putting the 'cycle' file to prompt a cycling of the scripts before the full wait period.

The script is started automatically from the /ffp/start directory.

If you change any of the directory names then you will need to do so in the install and the main script.  I will look at having the install script directory names automatically set in the main script at some point.

The script requires nothing more than ffp 0.5 and Transmission 1.40+ to be installed.

It does need some 'field testing' so anyone who is interested please downlod and feedback here.

I will upload it to http://dns323.thecorewithin.net/

It will be named trans_utils-0.2.tgz

Regards
RB

Offline

 

#34 2008-12-19 04:55:28

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Ok,

File is uploaded and I can download it.

Feedback / bug reports / thanks all welcome.

Regards
RB

Offline

 

#35 2008-12-22 06:59:28

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: Transmission added functionality util script.

I installed the script and it seems to work except if I set QUIT_TRANSMISSION_WHEN_INACTIVE=1. If it is set to 1, transmission does not seems to restart properly when a new torrent file is added to the watch directory.

A newbie question. Why the script looks for a "cycle now" file instead just to check if watch directoy has something? If it looks for any file, it will save us the trouble of create a "cycle now" file and deposit it there at the same time we drop a torrent file in.

ADDED on Dec 25:
Found the following in .transmission-daemon\logs\transmission-utilities.log

[Thu Dec 25 07:22:01 GMT 2008]  Starting set bandwidth.
[Thu Dec 25 07:22:01 GMT 2008]  Transmission state file not found.
[Thu Dec 25 07:22:01 GMT 2008]  No items found in SCHED_TIME. Not setting bandwidth allocation.
[Thu Dec 25 07:22:01 GMT 2008]  Finished set bandwidth.

Maybe the issue is because I don't have $TRANSMISSION_HOME/daemon/state for my installation.

This is the same for transmission 1.40 and 1.42.
Thanks.

EDITED on Dec 28:
Found the reason why trans_utils is not able to re-start transmssion...
When checking if transssmion is running, the statement
TRANSMISSION_IS_RUNNING=`ps -A | grep -v grep | grep transmission-d | wc -l` is used, but it will always return positive because trans_utils is running off ./transmission-deamon/script.

By changing it to
TRANSMISSION_IS_RUNNING=`ps -A | grep -v grep | grep bin/transmission-d | wc -l`

Transmission will re-start when a new torrent is added to the watch directory.

Last edited by toolbox (2008-12-29 04:12:18)

Offline

 

#36 2008-12-29 09:09:36

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Hi Toolbox,

Yep I noticed this too.

Have not go around to fixing it yet though, this latest update was as I took a day off from work as I had to oversee some builders.

I will add the change to the script you have proposed (and the credit to yourself).

As for why the script checks for a 'cycle' file with a specific file name, I also have another script for ushare which refreshes (restarts) ushare when new media files are added.  It also looks for a 'cycle' file with a different name in the same folder to save having two seperate folders, one for each app.

What I can do though is set the script up so that if the CYCLE_FILE variable is not set then it will cycle on any new file.  THe other thing you can do if you do wish to use the watch directory for more than one script is have another subdirectory in it which contains copies of the various 'cycle' files and you then just drop in the torrent (or other file) and then just copy / paste the cycle file in.

The set bandwidth function used to work very well by checking the current setting and only changing it if needed.  It seems that with v1.4+ they have removed the state file which could be queried and I have not found a replacement yet.  As there is no way of finding out the 'global' speed for transmission which I am aware of the script just blindly sets the speed regardless on each cycle (from memory).

I will download and take a quick peek now.

Regards
RB

Offline

 

#37 2008-12-29 10:04:23

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Ok,

The "No items found in SCHED_TIME. Not setting bandwidth allocation." message should read "No items found in SCHEDULE_ENTRIES variable.  Not setting bandwidth allocation."

Does the $SCHEDULE_ENTRIES variable have any values set at the top of the script and if so can you please paste a copy here ?.  I have corrected the error message to reflect SCHEDULE_ENTRIES and not SCHEDULE_ITEMS as the variable name.

I have added check for the CYCLE_FILE not being set and to sysle if any file then appears in the watch directory.
I have changed the 'ps' check as suggested.
I have added a couple more comments so evey function has at least one line for description.

Still to do;

Max concurrent processes code to be checked.
Find alternative to the old state file for bandwidth currently set.
Implement the logging severity so not all messages are logged if the user wishes.
Housekeeping for the log files
Possible e-mail alerts for new torrents added, new torrents completed (seeding) and torrents removed (seeding ration reached).  This depends on any installed email server on the DNS-323 as standard.  I believe there is but need to check and find out what it is.

I need to debug these changes before repackaging and cannot do that from work so will package up after a bit of testing tonight (hopefully).

Regards
RB

Offline

 

#38 2008-12-31 03:12:29

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: Transmission added functionality util script.

Maybe another issue when QUIT_TRANSMISSION_WHEN_INACTIVE is set to 1, when the DNS-323 is reboot or power cycle with active torrents. During startup, it is possilble that transmission has not been intialized completely and will not report any active torrents to trans_utils and trans_utils in turn will kill transmission.

Offline

 

#39 2009-01-02 05:34:45

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Hi Toolbox,

Ok, I take it you are meaning that the utils script is checking to see if Transmission is up and running before Transmission has had a chance to fully start up after a reboot.

Ok first thought then would be to introduce a three strikes wait cycle.

I can get the script to try once and if it gets no response then it will wait for a user specified time period (i.e. 1 minute) and then try again.  Thae script will do this 3 times before reporting a problem.  I don't think there is an option to find out if Transmission has fully started up.

That sould get round the issue.

RB

Offline

 

#40 2009-01-02 05:54:32

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: Transmission added functionality util script.

RimBlock, good luck with the changes with the script. Because of the slow download speed of transmission, I have switched to rtorrent (under Debian).

Offline

 

#41 2009-01-02 08:02:18

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Transmission added functionality util script.

Thanks Toolbox.

I will continue with Transmission for now as it does what I need and I am never in too much of a rush for downloads.

I have 250+ dvd's to rip so uShare can stream them for my XBox360.  i can then store them all in boxes.  This as you can imagine will take some time so script is not such high priority at the moment.

Regards
RB

Offline

 

#42 2009-01-03 06:22:50

heema
Member
Registered: 2008-12-16
Posts: 9

Re: Transmission added functionality util script.

thanks for the script and it works great

but i had to change in /ffp/start/trans_utils.sh
TO_KILL=`ps -a | grep $util_command | grep -v grep | cut -d' ' -f2`
to
TO_KILL=`ps -a | grep $util_command | grep -v grep | cut -d' ' -f1`

to be able to stop the script

Offline

 

#43 2009-01-03 21:01:47

heema
Member
Registered: 2008-12-16
Posts: 9

Re: Transmission added functionality util script.

i was also wondering, how can i change the queue list priority ?

Last edited by heema (2009-01-03 21:02:09)

Offline

 

#44 2009-01-04 18:15:39

heema
Member
Registered: 2008-12-16
Posts: 9

Re: Transmission added functionality util script.

i also had to change line 387 to:
if [[ "$DOWNLOAD_SPEED" -ne "$CURR_DOWN" ]] || [[ "$UPLOAD_SPEED" -ne "$CURR_UP" ]]; then

as nohup.out gave me before that
sh: -ne: argument expected

Offline

 

#45 2009-01-26 17:03:35

jmcqup
Member
From: Uganda
Registered: 2008-06-17
Posts: 23

Re: Transmission added functionality util script.

RimBlock. THis script is great! Thanks.

After I changed the Transmission boot script from nobody to my own user name (to be better able to manage downloaded files from Windows/Samba using an account set up with the DNS utilities), the trans_utils boot script stopped working... nohup.out said  "torrent_utils.sh: applet not found". I tried deleting and rerunning the install script but the same error came again. In my experiments, I also realized that I needed to run the boot script as my own user name as I had to chown to the .transmission-daemon directory for the first change.

What I came up with was :         su jmcqup -c "$TRAN_UTILS/$util_command &" in line 13.

Could you advise if my feeble-minded effort is likely to cause problems. At the moment it seems to work, but maybe a little less stable.

cheers

Offline

 

#46 2009-03-14 02:30:03

breasthead
Member
Registered: 2009-02-05
Posts: 38

Re: Transmission added functionality util script.

Hi,

I am interested to use the scripts here for transmission, but I just want to ask some stupid questions first as I found a link to an earlier version of this script (i think) which didn't work for me. Note, I have Transmission 1.50 currently working.

1. I read something about needing bash here in the forum, but I notice in the version d/l from http://dns323.thecorewithin.net/ on March 14 2009, the scripts say bash not needed, correct?

2. Is getting all this up and running as simple as running the install.sh script as user 'root' once the "configuration" section has been modified appropriately for torrent_utils.sh? Also where do I need to put the files on the dlink 323 which I extract from the .tgz?


Cheers for helping me out.
B

Offline

 

#47 2009-03-25 03:04:14

LeChuck
Member
Registered: 2008-11-14
Posts: 8

Re: Transmission added functionality util script.

Have the changes outlined by heema above been made to v0.2 of the script?
I recently upgraded from Transmission 1.22 to 1.51, the jump means i need to use a new script. My ISP has peak and off-peak so i have to schedule my bandwidth.

Many thanks to the script author too, not something i could have done myself.

Offline

 

#48 2009-03-27 22:22:28

LeChuck
Member
Registered: 2008-11-14
Posts: 8

Re: Transmission added functionality util script.

For those still interested in scripts, check these out from the TransmissionBT site:
http://trac.transmissionbt.com/wiki/Scripts
A bandwidth scheduler, block list updater and watch directory script.

I've got the bandwidth scheduler working

Offline

 

#49 2009-05-06 16:27:44

nyunyu
Member
Registered: 2009-05-03
Posts: 44
Website

Re: Transmission added functionality util script.

heema wrote:

thanks for the script and it works great

but i had to change in /ffp/start/trans_utils.sh
TO_KILL=`ps -a | grep $util_command | grep -v grep | cut -d' ' -f2`
to
TO_KILL=`ps -a | grep $util_command | grep -v grep | cut -d' ' -f1`

to be able to stop the script

I was looking for this.
After editing the file now it can be stopped.

Thanks.



[UPDATE]

Okay, how to uninstall or revert this hack?
I can't make it to work.

I want to stop or restart and for both I get this error:
root@dlink-0A78F3:/mnt/HD_a2# /ffp/start/trans_utils.sh restart
Usage: /ffp/start/trans_utils.sh start|stop|restart|status

root@dlink-0A78F3:/mnt/HD_a2# /ffp/start/trans_utils.sh stop
Usage: /ffp/start/trans_utils.sh start|stop|restart|status

So, after edit the files and changed f2 -> f1, the file can be stopped.

Then, I put a torrent in the watch folder to test if it is working but then nothing happened.
Torrent has been added into watch folder and transmission did not show any downloads.

I tried tyoing this into ssh
root@dlink-0A78F3:/mnt/HD_a2# transmission-remote -l
[21:44:04.242] JSON parser failed at line 1, column 1: "<h1>401: Unautho"
[21:44:04.243] transmission-remote: Unable to parse response "<h1>401: Unauthorized</h1>Unauthorized User"

Can anyone help?

Last edited by nyunyu (2009-05-06 17:22:47)


DNS323 + 2x1TB WD GREEN + Fun Plug 0.5 (Fonz) + Transmission 1.92 + Automatic 0.6 = GREAT!
Looking for Auto Direct Download script if possible smile

Offline

 

#50 2009-05-06 17:49:29

nyunyu
Member
Registered: 2009-05-03
Posts: 44
Website

Re: Transmission added functionality util script.

RimBlock wrote:

Right,

I have put the first verion up you know where (or if you dont then here -> http://dns323.thecorewithin.net/)

Download the Transmission torrent client utilities v0.1 package.
copy the tgz file to the root of your share (usually /mnt/HD_a2)
'tar -xzvf trans_utils-0.1.tgz' which will create a trans_utils-0.1 directory.
cd trans_utils-0.1
check the settings in the install.sh script

Your share point
BASE_SHARE=/mnt/HD_a2

FFP base location.  Note if you are using ffp 0.4 then post here as there may be a way to get it working if there is enough interest.
BASE_FFP=/ffp

Base location Transmission is installed to by default.  If you changed this default location then you need to change it here.
TRANS_BASE=$BASE_SHARE/.transmission

Names of the directories to both check for new torrents and to move completed torrents to (will be created in the base share directory).
SHARE_DIR_LIST='torrent_watch torrent_complete'

Once happy;
./install.sh

You should see a number of XXXX already exists or copied file XXX to location XXX messages and then a message about the script starting on reboot.

check the /mnt/HD_a2/.transmission/scripts/torrent_utils.sh file and change any variables to match paths etc as required.  I know there are quite a few and I may split them out to a config file with another release.

If you do not want to reboot then running '/ffp/start/torrent_utils.sh start' should work.

Log file is in /mnt/HD_a2/.transmission/logs

Any bugs, please post them here.

I will put a new release up after I have tidied the code and possible split out a seperate config file.

This is still very much a beta so although I do not believe it will cause any serious issues and has been running on my DNS-323 for a few days without any real problems be aware that I am not responsible for you choosing to use this suite of scripts.

Enjoy
RB

I use fonz fun plug 0.5 and Transmission 1.52.
Downloaded your script and fire it up into my NAS 323.
Unfortunately it does not work.
I checked the log and it says unauthorized.

Any idea?

*I have no idea how to uninstall so I removed everything that has been added manually.


DNS323 + 2x1TB WD GREEN + Fun Plug 0.5 (Fonz) + Transmission 1.92 + Automatic 0.6 = GREAT!
Looking for Auto Direct Download script if possible smile

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB