script not running

Discussion of Transmission that doesn't fit in the other categories
Post Reply
martzuk
Posts: 5
Joined: Wed Nov 23, 2011 2:38 pm

script not running

Post 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?
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: script not running

Post 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.
martzuk
Posts: 5
Joined: Wed Nov 23, 2011 2:38 pm

Re: script not running

Post 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
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: script not running

Post 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.
martzuk
Posts: 5
Joined: Wed Nov 23, 2011 2:38 pm

Re: script not running

Post 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"
martzuk
Posts: 5
Joined: Wed Nov 23, 2011 2:38 pm

Re: script not running

Post 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 :)
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: script not running

Post 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.
martzuk
Posts: 5
Joined: Wed Nov 23, 2011 2:38 pm

Re: script not running

Post by martzuk »

It seems to work fine :)
Post Reply