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

#1 2008-07-31 05:37:36

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

Transmission added functionality util script.

Hi

As some of you already know from the Transmission & Clutch thread (http://dns323.kood.org/forum/t1805-Tran … S-323.html) I am working on porting the torrent_helper.sh script by kyyhkynen originally written for the WD World book in bash and found at http://kyyhkynen.net/stuff/mybook/torrent_helper.php.

I have started a dedicated thread as it avoids it getting lost in or cluttering up the original Transmission & Clutch thread.

The following functionality will be added when completed.

1. Fully configurable.
2. Shuts down Transmission if there is nothing for it to do.
3. Moves completed torrents to a user defined directory when complete and seeded to a user defined
   seeding ratio.
4. Check a user defined watch directory for new torrent files to add to the Transmission queue.
5. Starts Transmission if it is not running and new .torrent files are in the watch directory.
6. Sets bandwidth allocation for upload and download based on day of week and time.
7. Cycles round every user defined number of seconds.
8. Limits the number of running processes.

Is there any other functionality people would like added as now is the best time for me to add it if it is possible. 

One item I will probably add is the ability to add a 'cycle now' flag file to the watch directory.  This would enable the script to cycle totally through all its tasks, say, every hour but it would check for the flag file every minute and finding it would prompt a cycle.  This would be useful if you added a new torrent file but didn't want to wait for up to an hour for it to be added to Transmission.

The script should be available in the next week or two with currently listed functionality.  People willing to test the script should make themselves known here.

Cheers
RB

Offline

 

#2 2008-07-31 17:08:03

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

Re: Transmission added functionality util script.

Progress.

New added function.

Script will cycle after a set pause period unless you put a file in the watch directory (default name 'cycle').  It will check for this file every XXX seconds and initiate a cycle of jobs if found.

i.e.
You set the standard cycle time to be every hour.  You set the cycle check time to be every 5 minutes.  All jobs in the script will run 1 hour after the last cycle unless it finds a cycle file.  It looks for the cycle file every 5 minutes to save you having to wait for the hour cycle to pic up new .torrent files or move completed items.

Outstanding items.

Check and rewrite if need the max running processes function.
Need to review the code for any obvious optimisations.
Need to write install script.
Need to write instructions.
Need to package.


New amendment to do.

Each cycle it will set the bandwidth even if it does not need setting.  Need to add a check if possible to change the bandwidth only if it needs changing.

Notes.

I am currently thinking of leaving out the max processes function.  It was added for the WD World book which seems to have very little processing ability and so could only manage 1 torrent without slowdown.  I have yet to see the DNS-323 slowdown with 10+ torrents downloading.  I may leave it in but disable it and release later if there is a demand for it.

RB

Offline

 

#3 2008-07-31 19:38:31

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

Re: Transmission added functionality util script.

RimBlock wrote:

Progress.

New amendment to do.

Each cycle it will set the bandwidth even if it does not need setting.  Need to add a check if possible to change the bandwidth only if it needs changing.

Notes.

I am currently thinking of leaving out the max processes function.  It was added for the WD World book which seems to have very little processing ability and so could only manage 1 torrent without slowdown.  I have yet to see the DNS-323 slowdown with 10+ torrents downloading.  I may leave it in but disable it and release later if there is a demand for it.

Bandwidth change only if required and hashing out the max threads section is now complete.

An overnight run should give an idea if it is all working ok.

Outstanding items.

Check and rewrite if need the max running processes function. (removed for now).
Write sanity checks for user defined parameters (i.e. cycle_file_check_time is never higher than total_cycle_time).
Need to review the code for any obvious optimisations.
Need to correctly allocate log levels to all messages.
Need to tidy and finalise code.
Need to write install script.
Need to write instructions.
Need to package.
Release for beta testing

Current Functionallity.

1. Fully configurable.
2. Shuts down Transmission if there is nothing for it to do.
3. Moves completed torrents to a user defined directory when complete and seeded to a user defined
   seeding ratio.
4. Check a user defined watch directory for new torrent files to add to the Transmission queue.
5. Starts Transmission if it is not running and new .torrent files are in the watch directory.
6. Sets bandwidth allocation for upload and download based on day of week and time.
7. Cycles round every user defined number of seconds.
8. Check for a 'cycle now' file at user specified intivals within the wait part of the job cycle (item 7).
9. Only changes bandwidth allocation if required (checks current allocation against specified allocation for time period).


RB

Offline

 

#4 2008-08-02 18:33:22

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

Re: Transmission added functionality util script.

More of a place holder before bed than an update.....

Need to also write the code to manage the log file generated. Initial thought is to count the number of lines after a certian file size is reached and to -10 lines from the top.  Check to be done with every cycle.

RB

Offline

 

#5 2008-08-02 20:30:53

BikNorton
Member
Registered: 2008-08-02
Posts: 16

Re: Transmission added functionality util script.

I have an idea for you, as I've noticed you like recycling scripts; you could write one script that monitors a directory, and when files are put in it, it checks for a script in /start with the same name.

What I mean is - this general script could monitor /mnt/HD_a2/recycle.bin once a minute. If it finds a file called "ushare", it checks for fun_plug.d/start/ushare.sh (of wherever ffp0.5 puts them) - if it's executable, it runs it with the "stop" parameter, then deletes the "ushare" file from recycle.bin. That way you only have one /bin/sh running one recycle.sh, and one /bin/sleep waiting, etc.

Same for 'tranmission', 'shutdown', and anything else you might want to trigger occasionally.

Last edited by BikNorton (2008-08-02 20:32:19)

Offline

 

#6 2008-08-03 07:08:21

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

Re: Transmission added functionality util script.

Hi BikNorton,

I was thinking along the same lines what with the uShare and the Trans / Clutch util scripts both doing the same sort of checking.

Maybe having a /mnt/HD_a2/triggers directory for checking for trigger files.
Having a /mnt/HD_a2/triggers/trigger_files directory for 'blank' trigger files so the user just has to copy from here to the trigger directory.
Having a /mnt/HD_a2/triggers/scripts directory for the scripts to trigger.
I don't think a single recycle script will be possible at this point as the scripts I have put together all have the ability for different timings for recycling and certianly this trans/clutch script does a lot more than just wait for a new torrent.  Setting bandwidth and moving completed files need to be checked for.  Saying that we could have a /mnt/HD_a2/triggers/perm_triggers folder containing trigger files with a one line entry with 'full-cycle=600 trigger-check=60".

When the start script runs for a 'job' that has been triggered it checks /mnt/HD_a2/triggers/trigger_files and touches and trigger file is it one is missing (people are bound to move rather than copy by mistake once or twice).

The trigger check script will monitor the trigger directory and fire scripts from the /mnt/HD_a2/triggers/scripts.  WHy I prefer putting them here is as it will make the system pretty independent from the ffp stuff and so changes Fonz may choose to implement should have minimal effect and it will also help not to clutter up the /ffp/start directory.  You would only need a trigger system start script in the /ffp/start folder to get the whole thing going.  There is no reason the scripts in the trigger_scripts diectory could not just call the scripts in the /ffp/scripts folder if required.

The Transmission & Clutch util script has been running for a couple of days now and I have found and removed a couple of bugs.  I may, if I have time, today put a quick installer together and package so people can take a look.  It will be a beta with all risks involved.  It seems to work fine on my NAS so should be fine for others.

RB

Offline

 

#7 2008-08-04 19:20:50

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

Re: Transmission added functionality util script.

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

Offline

 

#8 2008-08-04 19:42:57

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

Re: Transmission added functionality util script.

Ok,

First bug reported by me.

If you run the script multiple times it may shut down transmission as it reports there is nothing to do.

If this happens to you then dont panic just kill any instances you have of the script running and then start it again once with the script in ffp/start and it will pickup the torrents already in transmission (if there are any) and start transmission for you.

This is unlikely to happen and happened to me because as well as the start script for this in the ffp/start directory and I also had a line starting it in the transmission start script.

With the install you should not have this issue.

RB

Offline

 

#9 2008-08-06 04:24:57

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

Re: Transmission added functionality util script.

Ok,

Not sure how many peopel have downloaded or tried these scripts but surprised no one has commented that the script will not pick up new torrent files.

There is a line missing in the /mnt/HD_a2/.transmission/scripts/torrent_utils.sh

You can either add it or I will package and release again tonight.

If you open the file in vi -> [SHIFT]+G (goto bottom of file)

Change;

# Begin MAIN.
logger "Transmission_utilities.sh Started." 0

# repeat loop forever
        check_running_start
        check_status

to;

# Begin MAIN.
logger "Transmission_utilities.sh Started." 0

# repeat loop forever
        check_running_start
        new_torrent                                             #<- add this line
        check_status

It should now work file picking up torrents although there is a little bug with .torrent files containing spaces in their names.  It does not stop it working but throws up a couple of errors.  I will get rid of this at some point but it is not urgent. 

Also note that the file I downloaded is called trans_utils-0.1.tar and not trans_utils-0.1.tgz even though the page source is pointing to trans_utils-0.1.tgz.  If the file you download is called trans_utils-0.1.tar please rename it to trans_utils-0.1.tgz and report here as I am not sure if I am the only one experiencing this.

Thanks
RB

Offline

 

#10 2008-11-15 23:03:45

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

Re: Transmission added functionality util script.

Should this script work with latest Transmission?

Offline

 

#11 2008-11-16 11:37:35

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

Re: Transmission added functionality util script.

The 1.22 version of Transmission uses a TRANS_STATE_FILE $TRANSMISSION_HOME/daemon/state for saving things like download / upload limits, etc.  The current trans_utils expects this format.

Until RimBlock produces the next release I have updated the latest torrent_helper to work on DNS 323.  My firmware is 1.0.5 and I have ffp0.5 installed.  The scripts are using /ffp/bin/bash.

The tarball has the entire directory structure in it - there is no installer.   The WATCHDIR, WORKDIR and COMPLETEDIR are all as for original trans_utils.

The trans_utils.sh is now deployed to /ffp/bin
The /ffp/start/trans_utils_control.sh has been simplified and modeled after the samba.sh

/ffp/bin/trans_utils.sh uses /ffp/bin/logger - /var/log/messages for logs (this requires syslog to be enabled!)
/ffp/start/trans_utils_control.sh writes logs to /ffp/var/log/trans_utils.sh.log

INSTALLATION
-----------------

NOTE: None of the original files from trans_utils are used by this solution!.

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

See output of operation here...

root@dlink-95D930:/ffp/home/jason# tar -zxvf trans14_utils.tar.gz -C /
ffp/
ffp/start/
ffp/bin/
ffp/start/trans_utils_control.sh
ffp/bin/trans_utils.sh
mnt/
mnt/HD_a2/
mnt/HD_a2/torrent_watch/
mnt/HD_a2/torrent_complete/
mnt/HD_a2/torrents/

Last edited by BishopPell (2008-12-03 13:03:29)

Offline

 

#12 2008-11-16 20:21:00

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

Re: Transmission added functionality util script.

This doesn't work for me, log says localhost:9091 responded: "success" but the torrent I have in torrent folder does not begin to download. If I add the torrent manually, it does remove it after done seeding.

Here's what I have edited:
################
# Configuration
################

SAMBA_CHOWN=nobody

# Funplug base directory Path.
BASE_SYS=/ffp

# Transmission start / stop script directories.
TRANS_SCRIPT=/start

# Share base directory
BASE_SHARE=/mnt/HD_a2

# Transmission install directory.
TRANSMISSION_HOME=$BASE_SHARE/.transmission-deamon

# path to transmission-remote
# if you built transmission from source, you'll need to change this
TRANSMISSION_REMOTE=$BASE_SYS/bin/transmission-remote

# command to start transmission when it is not running
TRANSMISSION_START=$BASE_SYS$TRANS_SCRIPT'/transmission.sh start'

# command to stop transmission when it is running
TRANSMISSION_STOP=$BASE_SYS$TRANS_SCRIPT'/transmission.sh stop'

# transmission working directory
# note that if you're using the transmission startup script (/etc/init.d/transmission.sh),
# this should should be the same as in it
WORK_DIR=$BASE_SHARE/Torrents

# the directory to watch for new .torrent files
# leave blank if you don't want to use one
WATCH_DIR=$BASE_SHARE/Torrents

# the directory to put completed downloads into
# leave blank if you want to keep seeding completed downloads in the working directory
COMPLETEDIR=

# whether or not to remove completed downloads automatically at all
# if set to 0, torrents are seeded indefinitely until you remove them manually
# if set to 0, the following two settings won't have any effect on anything
REMOVE_COMPLETED=1

# the seeding ratio you'll want to be seeding the downloaded files to before removing them
SEED_UNTIL_RATIO=1.5

# how many torrents should be downloading at the same time
# recommended to keep this at 1, since mbwe does have so little memory and so slow cpu
MAX_SIMULTANEOUS=5

# how often the watch directory should be checked, in seconds
# by default 5 minutes (=300 seconds)
FREQUENCY=300

# whether or not to quit transmission, if there are no torrents in the queue.
# if quit, it will be restarted when something is found in the watch directory
# if you're planning on adding torrents also by other means (with clutch, for example)
# than using the watch directory, set this to 0
QUIT_TRANSMISSION_WHEN_INACTIVE=0

# bandwidth scheduling
# list schedules in following format
# SCHEDULE_DOWNLOAD[[hour to start]]=[download speed in kb]
# SCHEDULE_UPLOAD[[hour to start]]=[upload speed in kb]
# use 24h clock hours in the hours
# 0 as speed means unlimited
# the following examples limit the bandwidth during daytime ( 8 - 23 ) and set them unlimited for night
# note that your upload speed shouldn't be set to unlimited, but to
# about 90% of your total upload bandwidth in order to keep it from limiting your download speeds also...
SCHEDULE_DOWNLOAD[8]=0
SCHEDULE_UPLOAD[8]=0
SCHEDULE_DOWNLOAD[23]=0
SCHEDULE_UPLOAD[23]=0

# logging options
LOG_ENABLED=true
LOGGER="$BASE_SYS/bin/logger -t trans_utils"

############################################
# end of configuration
# you shouldn't need to edit anything below
############################################

Last edited by headman (2008-11-17 07:36:16)

Offline

 

#13 2008-11-17 13:57:48

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

Re: Transmission added functionality util script.

Hi,

My bad - a couple of the vars are incorrect.

WORK_DIR should be WORKDIR
WATCH_DIR should be WATCHDIR

Apologies but I did the simplest transformation of the original torrent_helper, so that slipped through.   I uploaded new version with these changes

Cheers
Jason

Offline

 

#14 2008-11-17 16:13:02

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

Re: Transmission added functionality util script.

To be clear with everyone, I made very little modification to the original torrent_helper to produce trans_utils.sh.  I provided a trans_utils_control.sh modelled after the /ffp/start/samba.sh and kept it very simple.  Any issues with the scripts that aren't related to the
configuration variables and the control script are most probably existing in the original script too.

There does appear to be some interesting issues with the MAX_SIMULTANEOUS setting.  The WEB UI reports that multiple torrents are downloading, but when you execute transmission-remote -l, the right number of torrents are Downloading!  Not sure why this mismatch, but it kind of seems like its an issue with transmission-daemon and transmission-remote.

Offline

 

#15 2008-11-18 07:29:54

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

Re: Transmission added functionality util script.

Now it's working, thanks!

Offline

 

#16 2008-11-23 14:57:19

DFreeze
Member
Registered: 2008-10-26
Posts: 7

Re: Transmission added functionality util script.

BishopPell, Thanks for your script. I've seen it fill my download list automatically - super! What I do see is that all files are put in the download queue at once (webUI). I set the max. simultaneous downloads to 2, since my modem chokes easily on torrent-traffic. But the webUI shows all as downloading, and transmission-remote -l gives at least five active torrents (only three are idle). Is something not quite OK with the max. simultaneous check?

Also, I see nothing in the logfile. It is there, but there's only a "localhost:9091 responded: "success"" every now and then. Does the systemlog need enabling for this to work? It might reveal a little more what the script is doing and where the max. simultaneous boundary kicks in (if ever).

::EDIT::

Never mind about the logfiles - I found them already. They were in /var/log, NOT in /ffp/var/log. But anyway, the messages only show "Nov 23 15:26:47 CH3SNAS user.notice trans_utils[26370]: Checking for schedule, torrents, etc...". No mention of a max. simultaneous, which should be there.

Any idea?

::EDIT::

Another few hours revealed some "max. simultaneous" messages in the log, so there must be something else going on. I think I know what it is: The running list is made using:

Code:

RUNNING_TORRENTS_LIST=`echo "$TORRENT_LIST" | grep Downloading`

But in transmission-remote -l I see many torrents having "Down & Up". This is probably new phrasing in 1.40, so I will try doing this tonight:

Code:

RUNNING_TORRENTS_LIST=`echo "$TORRENT_LIST" | grep Down`

I will keep you updated on progress.

::EDIT::

Couldn't resist...

I searched the sourcecode of 1.34 and 1.40 for the part where the status is set, and found it in "remote.c". In 1.34 these statusmessages are possible:

Code:

case TR_STATUS_CHECK_WAIT: return "Will Verify";
        case TR_STATUS_CHECK:      return "Verifying";
        case TR_STATUS_DOWNLOAD:   return "Downloading";
        case TR_STATUS_SEED:       return "Seeding";
        case TR_STATUS_STOPPED:    return "Stopped";
        default:                   return "Error";

For Transmission 1.40 this status presentation received some attention, and the following statuses are possible:

Code:

case TR_STATUS_CHECK_WAIT:
        case TR_STATUS_CHECK: {
            const char * str = status == TR_STATUS_CHECK_WAIT
                             ? "Will Verify"
                             : "Verifying";
            double percent;
            if( tr_bencDictFindDouble( t, "recheckProgress", &percent ) )
                tr_snprintf( buf, buflen, "%s (%.0f%%)", str, percent*100.0 );
            else
                tr_strlcpy( buf, str, buflen );

            break;
        }

        case TR_STATUS_DOWNLOAD:
        case TR_STATUS_SEED: {
            int64_t fromUs = 0;
            int64_t toUs = 0;
            tr_bencDictFindInt( t, "peersGettingFromUs", &fromUs );
            tr_bencDictFindInt( t, "peersSendingToUs", &toUs );
            if( fromUs && toUs )
                tr_strlcpy( buf, "Up & Down", buflen );
            else if( toUs )
                tr_strlcpy( buf, "Downloading", buflen );
            else if( fromUs ) {
                int64_t leftUntilDone = 0;
                tr_bencDictFindInt( t, "leftUntilDone", &leftUntilDone );
                if( leftUntilDone > 0 )
                    tr_strlcpy( buf, "Uploading", buflen );
                else
                    tr_strlcpy( buf, "Seeding", buflen );
            } else
                tr_strlcpy( buf, "Idle", buflen );
            break;
        }

So there is a new status "Up & Down" as well as a status "Uploading", but I think the above fix (grep "Down") will do the trick. Results due tonight!

::EDIT::

Another day, another edit. Please notify me if you are getting tired of my ramblings ;-)

As any of you (probably more capable bash scripters) would have noticed immediately: the 'column header' line (the one with ID Done ETA Up Down Ratio Status Name) also contains the phrase 'Down'. So the script log was filled with attempts of trying to stop the torrent 'ID Ratio Up ...'. Please be gentle and don't laugh too loud (chuckles allowed).

Tonight I will try another grep attempt, this time specifying the exact names like this:

Code:

RUNNING_TORRENTS_LIST=`echo "$TORRENT_LIST" | grep -E 'Up \& Down|Downloading|Uploading|Seeding'`

Please note I add the Uploading status as well, since I use this script to cap the number of active torrents, not just the downloading ones. My modem is of a fickle type, choking easily when too many connection (attempts) are made.

This line I've also edited, again with 'Uploading' and 'Seeding' statuses included.

Code:

get-torrent-filename() { echo `echo $1 | awk 'BEGIN{FS="(Up & Down|Downloading|Uploading|Seeding|Idle)[ ]+"};{print $NF}' 2>/dev/null`; }

When (if) I get it working right with Transmission 1.40 I will attach the resulting script here. You can do a diff with the 'base version' from BishopPell to see what has been changed, and you can keep what works for you. But now to get it working...

::EDIT::

It seems to work now. I'll attach the resulting script here, for anyone to use / modify or whatever. I've altered functionality slightly so the script caps active torrents, not just downloading ones. This is because my modem really doesn't like many torrents and the frequent connections that go with them, even uploading / seeding ones. You can change it back to just capping downloads easily - it's in the comments sections of the script.

I also added a slight delay (5 seconds) in the automatic-torrent-starting section. When started, all torrents are Idle until a connection is made. The while-loop however goes so fast that it starts all torrents since none of them were active quick enough. The next run of the script will fix this, but since my modem is really sensitive to many connections, I added a "sleep 5000".

Last edited by DFreeze (2008-11-28 13:38:29)


Attachments:
Attachment Icon trans_utils.sh, Size: 12,968 bytes, Downloads: 460

Offline

 

#17 2008-11-25 10:12:25

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

Re: Transmission added functionality util script.

Wow, this is still going huh.

Sorry but I have been in Switzerland on business for the last 3 months or so and my DNS-323 drives overheated and corrupted just before I left so I have not really had a look at any of this stuff recently.

I will have a quick look sometime in the next week to see how things have moved on.

Oh, one point to make about the logs going to /var/log was that to my understanding (and memory) /var/log was mounted on flash so a reboot would wipe out any log files (potentially ones highlighting why the unit rebooted) and the flash is not so big so there is the risk of filling up the flash area used by the system in most cases if the unit is run 24*7 like mine was.

Cheers
RB

Offline

 

#18 2008-11-26 19:54:50

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

Re: Transmission added functionality util script.

DFreeze wrote:

It seems to work now. I'll attach the resulting script here, for anyone to use / modify or whatever. I've altered functionality slightly so the script caps active torrents, not just downloading ones. This is because my modem really doesn't like many torrents and the frequent connections that go with them, even uploading / seeding ones. You can change it back to just capping downloads easily - it's in the comments sections of the script.

I also added a slight delay (5 seconds) in the automatic-torrent-starting section. When started, all torrents are Idle until a connection is made. The while-loop however goes so fast that it starts all torrents since none of them were active quick enough. The next run of the script will fix this, but since my modem is really sensitive to many connections, I added a "sleep 5000".

Not working for me and it does not generate any log except in /ffp/var/log/trans_utils.sh.log:
transmission-remote: (localhost:9091) Couldn't connect to server
transmission-remote: (localhost:9091) Couldn't connect to server
transmission-remote: (localhost:9091) Couldn't connect to server
transmission-remote: (localhost:9091) Couldn't connect to server
Stopping transmission-daemon

I have .torrent files in /mnt/HD_a2/Torrents/new and when completed move them to /mnt/HD_a2/Torrents/done and these I changed to your script. The old script worked fine.

Offline

 

#19 2008-11-28 13:37:13

DFreeze
Member
Registered: 2008-10-26
Posts: 7

Re: Transmission added functionality util script.

Hmm, strange. I added (but didn't mention above) a reference to the other harddisk. Transmission is on one disk, and my torrent-files and media are on the other. So, there is a difference between '$BASE_SHARE' and '$TORRENT_SHARE'. Maybe, if you have both on the same disk, you have to replace some of the instances of either to the other. If that doesn't work, you could use the old script and just replace get-torrent-filename() with:

Code:

# function to extract the file name of the torrents from the given line 
get-torrent-filename() { echo `echo $1 | awk 'BEGIN{FS="(Up & Down|Downloading|Uploading|Seeding|Stopped|Idle)[ ]+"};{print $NF}' 2>/dev/null`; }

and RUNNING_TORRENTS_LIST with

Code:

RUNNING_TORRENTS_LIST=`echo "$TORRENT_LIST" | grep -E 'Up \& Down|Downloading|Uploading|Seeding'`

Those are essentially the ones adapted for Transmission 1.40.

I forgot the 'Idle' state as fileseparator (FS) in get-torrent-filename(), so I updated the attached script with this correction. Good luck in trying to get it working!

Offline

 

#20 2008-11-28 18:42:25

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

Re: Transmission added functionality util script.

It's working now thanks to your fixes! Great job smile The logging still does not work tho

Last edited by headman (2008-11-29 07:58:37)

Offline

 

#21 2008-11-29 16:35:19

DFreeze
Member
Registered: 2008-10-26
Posts: 7

Re: Transmission added functionality util script.

Did you check the system log as well (that's not in /ffp/var/log, but in /var/log)?

please try:

cat /var/log/messages

or

cat /var/log/messages | grep trans_

to only get the items generated by the script.

Offline

 

#22 2008-11-29 21:43:21

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

Re: Transmission added functionality util script.

It did not occur to me to check inside the message, Linux newbie in the house! :-)

If there's nothing downloading, it deletes the torrents I have in the folder that it checks for new torrents and it never starts the transmission client if it's been stopped. Any ideas why this happens? I had to change these lines to keep it running:

REMOVE_COMPLETED=0
QUIT_TRANSMISSION_WHEN_INACTIVE=0

Offline

 

#23 2008-12-02 10:45:16

DFreeze
Member
Registered: 2008-10-26
Posts: 7

Re: Transmission added functionality util script.

Don't know what happens - obviously the script has problems starting transmission back up. I would have to test if transmission is started automatically over here, to verify if the script is correct. Will try that and report back.

Is the path to transmission.sh (/ffp/start/transmission.sh) set correctly?

Offline

 

#24 2008-12-02 17:52:13

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

Re: Transmission added functionality util script.

DFreeze wrote:

Don't know what happens - obviously the script has problems starting transmission back up. I would have to test if transmission is started automatically over here, to verify if the script is correct. Will try that and report back.

Is the path to transmission.sh (/ffp/start/transmission.sh) set correctly?

I have not changed it:
# command to start transmission when it is not running
TRANSMISSION_START=$BASE_SYS$TRANS_SCRIPT'/transmission.sh start'

# command to stop transmission when it is running
TRANSMISSION_STOP=$BASE_SYS$TRANS_SCRIPT'/transmission.sh stop'

And it is weird because it can run the stop command automatically. Any ideas why it deletes the new torrents and does not start to download them?

Offline

 

#25 2008-12-03 11:02:56

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

Re: Transmission added functionality util script.

Wow - did not realise there would be so much attention to my "quick hack" of the torrent_helper. 

For logging you really need to enable the syslog service in order to see your logs.  The original torrent_helper used syslog and I did not want to have to change more than absolutely necessary, especially if the upstream author did all the work for us again and released a new version.  Not sure if there is a way to configure /ffp/bin/syslog to write to /ffp/var/log/messages

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB