Torrent complete script help

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
windyboi
Posts: 12
Joined: Tue Nov 10, 2015 7:26 pm

Torrent complete script help

Post by windyboi »

Hello

I have written my first ever bash script and would really appreciate some help if this will work before I deploy it and break anything!!

I will be running this script on my FreeNAS jail:

Code: Select all

#! /bin/bash
# IF torrent contains music (torrent folder is in /mnt/music) then copy it to the afp share /mnt/newmusic

parentdir="$(dirname "$TR_TORRENT_DIR")"
if [ $parentdir="/mnt/music/" ]
then
cp $TR_TORRENT_DIR /mnt/newmusic
fi
Thank you so much
Last edited by windyboi on Sun Feb 21, 2016 1:57 pm, edited 2 times in total.
windyboi
Posts: 12
Joined: Tue Nov 10, 2015 7:26 pm

Re: Torrent complete script help

Post by windyboi »

Doesn't seem to work :/ I've set the script for permissions 777 and tested it out but it's not happening. Argh!
windyboi
Posts: 12
Joined: Tue Nov 10, 2015 7:26 pm

Re: Torrent complete script help

Post by windyboi »

Right I think I have bigger problems than formatting of the script..


In the FreeNAS GUI for transmission settings, under "Script torrent done" I've got /scripts/test.sh

test.sh is executable by all and contains:

#!/usr/local/bin/sh
echo "test" >> /scripts/test.txt

But, upon completion of a torrent, the script does NOT have the desired effect.

Do you know what might be causing this?

/scripts is also writeable by all (777 permission)

both the test.sh file and the directory are owned by the transmission user
windyboi
Posts: 12
Joined: Tue Nov 10, 2015 7:26 pm

Re: Torrent complete script help

Post by windyboi »

I can't find any settings.json using the guidance you provided. I am using FreeNAS built in transmission plugin, which has its own GUI options and thats is where I put the path to the script.

And yes, the test.txt isn't even created.

Thanks
windyboi
Posts: 12
Joined: Tue Nov 10, 2015 7:26 pm

Re: Torrent complete script help

Post by windyboi »

OMG the problem was the shebang at the top.. for whatever reason I was using /usr/local in my test and i changed t to just /bin/sh and now it works.

Sorry for hassle.. thanks for your assistance :)
Post Reply