Okay, so I have Transmission setup "headless" on my NAS, and I have a script setup to run on completion.
However, it doesn't. I've triple-checked the path to my script (which is given as an absolute path) and that "script-torrent-done-enabled" is set to true, however the script just doesn't get invoked at all.
I know the script works as I can supply it with sample values and it runs correctly, and I've also set it up to store all of its output to a log-file (so I should be able to get any error messages or warnings it produces). However, it just doesn't seem to be firing at all. The script is readable and executable by the user that transmission runs as.
The only log I can find for Tranmission are messages that transmission-daemon has sent my main system log, but there is no message indicating any attempt (failed or otherwise) to trigger the script.
I'm at a loss as it what else I can do to debug what's (not) happening; is there another log file I can look for that Transmission might be outputting any errors into? The package I have is an older build of Transmission (2.50) but it's behaved itself perfectly well other than this issue.
On Completion Script Silently Failing?
Re: On Completion Script Silently Failing?
Since the log doesn't show the "Calling script ...<path/script>" line, you're probably editing the wrong configuration file, or forgot to stop the daemon before editing it, or ... not enough relevant information to know what the problem is.
To see where the configuration file is, just use "transmission-remote -si" (might need the -n user & password, depending on configuration).
To see where the configuration file is, just use "transmission-remote -si" (might need the -n user & password, depending on configuration).
Re: On Completion Script Silently Failing?
Thanks for the tip, it looks like the configuration location Transmission reports is just a link to the folder I was editing anyway. The settings are definitely being updated as I've tweaked other things like disabling the download queue, enabled RPC password etc., which are all working as expected, and my NAS isn't currently in its final position so it's switched off (along with Transmission) each day, so it's definitely loading from the settings file, though I've been stopping the daemon before edits and re-opening once done anyway so I can get the changes straight away, and avoid overwrites.
The output from the -si flag doesn't include anything about log file location or the completion script though, are either of these things it would normally mention, e.g - under the Misc section?
The output from the -si flag doesn't include anything about log file location or the completion script though, are either of these things it would normally mention, e.g - under the Misc section?
Re: On Completion Script Silently Failing?
No, there's never been information about the script, or log (and there's no other log unless you tell the daemon with a start-up parameter, i.e. -e, and optional related parameters --log-error, --log-debug... but that's on a version 2.77).
The 2nd most common mistake is to assume PATH is defined the same as the user's path (which makes the script work fine on a terminal test, but not when run from transmission). But if the log doesn't show the script being called, then that's not relevant.
Another possibility is that the system doesn't have enough resources (i.e. RAM + swap) to run the script, the daemon just gets an error while trying to execute it (I'm not sure if that error is reported, or not).
The 2nd most common mistake is to assume PATH is defined the same as the user's path (which makes the script work fine on a terminal test, but not when run from transmission). But if the log doesn't show the script being called, then that's not relevant.
Another possibility is that the system doesn't have enough resources (i.e. RAM + swap) to run the script, the daemon just gets an error while trying to execute it (I'm not sure if that error is reported, or not).
Re: On Completion Script Silently Failing?
As you say it doesn't seem likely, plus I've put pretty robust checks in for the various variables that Transmission provides, so it should at the very least provide an error complaining it doesn't have a torrent name or whatever.rb07 wrote:The 2nd most common mistake is to assume PATH is defined the same as the user's path (which makes the script work fine on a terminal test, but not when run from transmission). But if the log doesn't show the script being called, then that's not relevant.
It shouldn't be that, my NAS has 256mb of RAM, about 40mb used by the system normally, plus another 40mb by Transmission.rb07 wrote:Another possibility is that the system doesn't have enough resources (i.e. RAM + swap) to run the script, the daemon just gets an error while trying to execute it (I'm not sure if that error is reported, or not).
Do any other settings affect the script running? I have a separate download and incomplete folder set, and use .part for incomplete files, but I assume the script doesn't run until .part is removed and the file moved into the correct location?
Re: On Completion Script Silently Failing?
No, nothing else affects that operation.Renara wrote:Do any other settings affect the script running?
Another possibility: a syntax error in settings.json, which prevents the actual setting to be done. This would cause a message in the log when the daemon starts.
Checking the code, the daemon does write an error message if the script execution fails (search for "error executing script <script>:<error desc>").
I would double check everything (correct path, executable mode set, transmission's user access to the script, no "Calling" in the log, version and builder -- is the original daemon, or a modified version).
Re: On Completion Script Silently Failing?
Oh my god. *facepalms* I re-checked the script permissions and somehow I managed to set group and everyone to executable, but not owner. I have no idea how that's even possible as I'm pretty sure I just used the usual "chmod +x foo" command, but the script seems to be running exactly as expected now.
Anyway, thanks everyone for all the many helpful suggestions, I just wish it wasn't such an embarrassing and minor mistake on my part. It is kind of weird that Transmission doesn't report a permissions error though; now that the script runs I see a corresponding log entry, but with the incorrect permissions I saw nothing in the logs at all.
Anyway, thanks everyone for all the many helpful suggestions, I just wish it wasn't such an embarrassing and minor mistake on my part. It is kind of weird that Transmission doesn't report a permissions error though; now that the script runs I see a corresponding log entry, but with the incorrect permissions I saw nothing in the logs at all.