Running a script after a download completes

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
Jleagle
Posts: 9
Joined: Wed Jan 02, 2013 11:45 am

Running a script after a download completes

Post by Jleagle »

I have Transmission installed on a Synology NAS and I am trying to get a script to run after each download completes.

I have:

Code: Select all

"script-torrent-done-enabled": true, 
"script-torrent-done-filename": "/volume1/Scripts/download_complete.sh", 
in settings.json

But as far as I can tell download_complete.sh never runs. Any reasons why this might be happening?

Thanks.
JJTagy
Posts: 40
Joined: Sun Jul 29, 2012 3:15 am

Re: Running a script after a download completes

Post by JJTagy »

Is the .sh executable (permissions)? Have you tried running the script manually?
Jleagle
Posts: 9
Joined: Wed Jan 02, 2013 11:45 am

Re: Running a script after a download completes

Post by Jleagle »

The script has CHMOD 0777.
How can i run it manually, doesn't Transmission send certain parameters to the script too?
Jleagle
Posts: 9
Joined: Wed Jan 02, 2013 11:45 am

Re: Running a script after a download completes

Post by Jleagle »

x190 wrote:
JJTagy wrote:Is the .sh executable
chmod +x.

Also, does the script have the 'shebang' line?
I have "#!/bin/sh" as the first line..

What does "chmod +x" mean? I don't know too much command line..
killemov
Posts: 573
Joined: Sat Jul 31, 2010 5:04 pm

Re: Running a script after a download completes

Post by killemov »

x190 wrote:chmod +x yourscript.sh
ls -la yourscript.sh
-rwxr--r--
x is for executable.
Correct! But ...
Jleagle wrote:The script has CHMOD 0777.
How can i run it manually, doesn't Transmission send certain parameters to the script too?
Probably 777 right? So your file attributes ARE ok.
Please put a line like:

Code: Select all

echo "Script started." >> /var/lib/myscript.log
At the beginning of the script and run it manually just to test it.
Do you know HOW to run a script manually?
Jleagle
Posts: 9
Joined: Wed Jan 02, 2013 11:45 am

Re: Running a script after a download completes

Post by Jleagle »

I have tried running the script like so:

Code: Select all

DiskStation> cd /volume1/Scripts
DiskStation> sh download_complete.sh
: not foundmplete.sh: line 3:
: not foundmplete.sh: line 5:
: not foundmplete.sh: line 8:
: not foundmplete.sh: line 10:
download_complete.sh: line 14: syntax error: unexpected word (expecting "do")
DiskStation>
The start of the script is this:

Code: Select all

#!/bin/sh
#Called after a download completes

echo "Script started." >> /var/lib/myscript.log
And it successfully created the file "myscript.log" with "Script started."

I deleted "myscript.log" and downloaded a torrent, the log file was never recreated.
Post Reply