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/torrent_done.sh'
Next, I created the /etc/torrent_done.sh
script:
#!/bin/sh
/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 torrent_done.sh
root@turris:/etc/# la -al torrent*
-rwxr-xr-x 1 root root 318 Mar 27 10:02 torrent_done.sh*
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 torrent_done.sh
file:
# chmod +r torrent_done.sh
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
totransmission
(the user associated w/ the daemon)? - Given that the mount point (
/mnt/jetdrive
) is owned by theroot
user, will the script be able to actually move the file? Do I need tochown
the file to theroot
user in the script?