Okay, so I have Transmission setup to run headless, and I have a script that runs on completion, as well as a few other scripts to handle automatically setting priority, peers etc. for new torrents and so-on.
Anyway, until recently, these had a lot of duplicate variables and functions, so decided to move them out into a separate file which I then import using the source command. Although this works perfectly when I run the script manually via a terminal, it doesn't appear to be working when Transmission executes the script as nothing is happening at all (the script is supposed to change a few settings on the torrent and send me an e-mail).
First of all, is this a problem with my use of the source command? I've also tried importing the common elements using an eval statement, but that doesn't appear to work either.
Secondly, how can I debug this? The script isn't writing anything to its log file, I've even tried adding exec > "$DIR/debug.log" which I believe should redirect all stdout output to a log-file, but I'm not getting any of it, even though there is plenty that the script should be outputting, even if some part is generating an error (though like I say, if I run it manually it works perfectly, no errors of any kind). I also can't find any Transmission logs that seem to be reporting a problem; I'm running it headless so I can't access the message viewer like in the GUI clients.