Transmission: script_torrent_done_filename

I’m hoping to configure the transmission daemon to move a file after the torrent has completed.

As such, I altered the /etc/config/transmission file to include:

option script_torrent_done_enabled 'true'
option script_torrent_done_filename '/etc/'

Next, I created the /etc/ script:


/usr/bin/create_notification -s news "CZ" "torrent finished"

echo $TR_TORRENT_DIR/$TR_TORRENT_NAME >> /etc/torrents.log

echo -e "Subject: $TR_TORRENT_NAME finished.\n\nTransmission finished downloading \"$TR_TORRENT_NAME\" on $TR_TIME_LOCALTIME" | msmtp --debug root

echo "Moving $TR_TORRENT_NAME to /mnt/jetdrive/Series"
mv $TR_TORRENT_NAME /mnt/jetdrive/Series

Next, I marked it as executable:

root@turris:/etc/# chmod +x
root@turris:/etc/# la -al torrent*
-rwxr-xr-x    1 root     root           318 Mar 27 10:02*

I executed the script and it produced the expected result.

However, the script was not executed when a torrent was completed.

** edit **

I added +r to the file:

# chmod +r

and the script executed.

It successfully:

  • sent an email message

It did not:

  • generate a notification
  • create a log file entry (or the file itself)
  • move the file

A few questions:

  • Do I need to change the script’s owner from root to transmission (the user associated w/ the daemon)?
  • Given that the mount point (/mnt/jetdrive) is owned by the root user, will the script be able to actually move the file? Do I need to chown the file to the root user in the script?

Transmission already has the ability to put completed downloads into a specific folder, “download-dir” in the settings file. Your destination folder should be owned by the user of the daemon, or have open world access.

1 Like

Decided to take @scottjl’s advice and use transmission’s download directory.

I added this line to the /etc/config/transmission:

option download_dir '/mnt/jetdrive/Series'

As such, I need to grant world write access to the directory:

# chmod o+w /mnt/jetdrive/Series

The resulting


# create a Foris notification
/usr/bin/create_notification -s news "CZ text" "torrent \"$TR_TORRENT_DIR/$TR_TORRENT_NAME\" finished"

# send an email message
echo -e "Subject: $TR_TORRENT_NAME finished.\n\nTransmission finished downloading \"$TR_TORRENT_NAME\" to $TR_TORRENT_DIR on $TR_TIME_LOCALTIME." | msmtp --debug root

# add the torrent to a log file
echo $TR_TIME_LOCALTIME\t$TR_TORRENT_DIR/$TR_TORRENT_NAME >> /tmp/transmission/torrents.log