how to test torrent done script?

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
tetorr
Posts: 7
Joined: Wed Feb 08, 2012 8:52 pm

how to test torrent done script?

Post by tetorr »

I'm writing a torrent done script based of the unrar and cleanup script. I want to know how to test the script? When it runs from transmission it gets a bunch of environment variables. Do I test the script by passing those as arguments? Or is there a command to tell torrent-remote to execute the script?
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: how to test torrent done script?

Post by gunzip »

see https://trac.transmissionbt.com/wiki/Ed ... Files#Misc

in settings.json:

script-torrent-done-enabled: Boolean (default = false) Run a script at torrent completion (set to true)
script-torrent-done-filename: String (default = "") Path to script (self-explanatory)

this is very simple test script to see that it works:

Code: Select all

#!/bin/bash
echo "$TR_TORRENT_NAME is completed" >> /tmp/test.log
if all goes well, the file /tmp/test.log should be created, then you can try more useful scripts.

also make sure script has execute permissions chmod +x /path/to/your/script
tetorr
Posts: 7
Joined: Wed Feb 08, 2012 8:52 pm

Re: how to test torrent done script?

Post by tetorr »

I don't think you got my OP. I need a way to test the script independently of transmission. Otherwise, I have to wait for a torrent to finish to see if the script works. That can become painful for complicated scripts.
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: how to test torrent done script?

Post by gunzip »

tetorr wrote:I don't think you got my OP. I need a way to test the script independently of transmission. Otherwise, I have to wait for a torrent to finish to see if the script works. That can become painful for complicated scripts.
well you can always try manually running the script from the terminal, but the problem is if your complicated script depends on any of the transmission envirnomental variables, it won't run correctly.

why don't you find a very small torrent and use that for a test, that's what i always did.
tetorr
Posts: 7
Joined: Wed Feb 08, 2012 8:52 pm

Re: how to test torrent done script?

Post by tetorr »

gunzip wrote:
tetorr wrote:I don't think you got my OP. I need a way to test the script independently of transmission. Otherwise, I have to wait for a torrent to finish to see if the script works. That can become painful for complicated scripts.
well you can always try manually running the script from the terminal, but the problem is if your complicated script depends on any of the transmission envirnomental variables, it won't run correctly.

why don't you find a very small torrent and use that for a test, that's what i always did.
ok thanks. At least you confirmed that there is no easy way to do this. Was jsut hoping transmission remote could be sent a command to run the download done script on an already completed torrent.

Now to find a small or freeleech avi file which meets my needs...
tetorr
Posts: 7
Joined: Wed Feb 08, 2012 8:52 pm

Re: how to test torrent done script?

Post by tetorr »

Cant get it to work. It is not creating a log file in /tmp. Does transmission log errors to a file somewhere?

EDIT: Found it on syslog. Set the message level to 3. IT says it calls the script. But there is no error nor confirmation message that the script worked :/

Interesting I can run my script if I type

Code: Select all

sh scriptname
but if I just type scriptname, without the sh, it does not run. Why is that? I did the chmod +x.
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: how to test torrent done script?

Post by gunzip »

tetorr wrote:Interesting I can run my script if I type

Code: Select all
sh scriptname

but if I just type scriptname, without the sh, it does not run. Why is that? I did the chmod +x.
you have to use a leading ./ if the script is in the current directory, such as:

./scriptname
tetorr wrote:IT says it calls the script.
that's good, you got past the first hurdle, but transmission does not report whether the script was successfully run, it just lets you know it was called and attempted to run it.

so i would say double-check your entries is settings.json , making sure there something like this

script-torrent-done-enabled: true,
script-torrent-done-filename: "/absolute/path/to/scriptname",

always use the fully-qualified path to your script or transmission won't find it.
tetorr
Posts: 7
Joined: Wed Feb 08, 2012 8:52 pm

Re: how to test torrent done script?

Post by tetorr »

thanks. I found out why I couldn't run the script without sh.
The first line in the script was missing a / on the location of sh.

I've checked the location of script many times. I even moved it to another disk. I'll keep looking.
Post Reply