Page 1 of 1

script not running

Posted: Wed Nov 23, 2011 2:44 pm
by martzuk
hi guys, I've setup transmission to run a shell script after a torrent finishes, however it is not being called

I set full 777 permissions on the script (sends a prowl push notification to my iPhone, script is tested and works, as does a simple script to create a blank txt file)
I set chmod +x on it

I checked the syslog and found that it is being called:

Code: Select all

Nov 23 14:23:39 MARTY-UBUNTU transmission-daemon[2141]: TorrentHere Calling script "/home/marty/torr.sh" (torrent.c:1913)
It is definitely setup in my settings.json, I've set it with:

Code: Select all

transmission-remote -n username:password --torrent-done-script /home/marty/torr.sh
I've restarted the daemon and checked the settings.json and all is set correctly

I've also run killall transmission-daemon and started it again but no joy,

I'm running transmission-daemon 2.33 (12565) on ubuntu 11.10 x64

Am I doing something wrong here or is it a bug?

Re: script not running

Posted: Wed Nov 23, 2011 5:03 pm
by rb07
You have to check if the user running transmission has access to your script, it probably doesn't, so it can't even read it.

You can fix that by moving the script to some place where the daemon has access, for instance I use the config directory, where the settings.json are, and make those permissions +rx.

Re: script not running

Posted: Thu Nov 24, 2011 12:21 am
by martzuk
still not any good, moved it to /var/lib/transmission-daemon/info, chmod +rx, script is owned by user and group debian-transmission

Code: Select all

appears again in syslog: Calling script "/var/lib/transmission-daemon/info/torrent_complete.sh" 
script wasn't run though

Re: script not running

Posted: Thu Nov 24, 2011 1:34 am
by rb07
It is being run, it just not working.

Another factor is the different environment when you run it than when the daemon runs it. Change all commands used to the full path of the command, or set PATH at the top of the script to something that will allow the script to find the commands its using.

Re: script not running

Posted: Thu Nov 24, 2011 12:32 pm
by martzuk
please excuse my n00bness but I'm not sure exactly what you mean about setting the path in the script? I've posted the script I use

Code: Select all

#!/bin/sh
curl -k https://prowl.weks.net/publicapi/add -F apikey=APIKEYHERE -F priority=-1 -F application="Transmission" -F event="Download Complete" -F description="$TR_TORRENT_NAME completed at $TR_TIME_LOCALTIME"

Re: script not running

Posted: Thu Nov 24, 2011 3:42 pm
by martzuk
aaah, I see what you mean't I've modified it and got it working

Code: Select all

#!/bin/sh
/var/lib/transmission-daemon/info
curl -k https://prowl.weks.net/publicapi/add -F apikey=APIKEYHERE -F priority=-1 -F application="Transmission" -F event="Download Complete" -F description="$TR_TORRENT_NAME completed at $TR_TIME_LOCALTIME"
thanks so much :)

Re: script not running

Posted: Thu Nov 24, 2011 4:45 pm
by rb07
That looks wrong, is it really working or is it missing a cd (change dir)?

By changing the path I meant:

Code: Select all

PATH=/location/of/curl:$PATH
or using:

Code: Select all

/location-of-curl/curl ...
Nice use of curl by the way.

Re: script not running

Posted: Thu Nov 24, 2011 4:59 pm
by martzuk
It seems to work fine :)