Personal site of Pieter Bogaerts

Transmission Daemon auto remove torrents

Since a few days I’m running the Transmission Daemon on my modified Apple TV 1st gen. I’ve had trouble with Couchpotato and Sickbeard renaming and moving files that were finished downloading but still being used by the Transmission Daemon. To fix this problem I’ve added a simple script as a cronjob that checks for completed torrents and removes them from the Transmission Daemon.

The script is called ‘removecompletedtorrents.sh’ and I’ve put it in the ‘bin’ folder.

Credits to 1000umbrellas

In my ‘crontab’ file in the ‘etc’ folder I’ve added the following line to run the script every minute.

Now Couchpotato and Sickbeard can automatically rename and move the files without a problem.

Comments on the original article

Great article. Thanks for the script! I have it up and running with Couch Potato and Sickbeard. Just a note to add to this article. You have to make sure and install the “Transmission-CLI” package as well as Transmission itself. Otherwise, the cron job will not do anything at all when the “transmission-remote” command is issued by the script. I took me a while to experiment and figure that part out. -- Techguy615
Thanks alot! it worked right out of the box -- Rasmus
Do I need to add in my user and password in the area inside the script? Also do I need to make this executable? -- IDS07
Hey IDS, You can set the username and password of transmission on line number 2, 8 and 12. On these lines you’ll find the following piece of code: ‘–auth=user:password’. You have to replace ‘user’ with your username and ‘password’ with your password. And yes, you have to call this script with a cronjob or something to run it. -- Pieter Bogaerts
If I run the script alone it works, but if I leave it to the Cron… nothing gets removed. cron is running. -- IDS07
What user is running the transmission daemon? Set the correct user (in this example ‘root’) in the crontab file. I hope that works. Pieter Bogaerts
I started transmission-daemon as root and use root in the cron… still not workings -- IDS07
Did you install the Transmission-CLI package mentioned by Techguy615 before? -- Pieter Bogaerts
Yep, like I mentioned before, if I run the script myself it works great. But the cron isn’t running it, This might be a cron issue cause no other crons are running either. -- IDS07
Hmmm that’s strange. Might be a user issue or indeed a problem with the cronjob. Please let me know if you found out what it was. -- Pieter Bogaerts
IDS07, It may be a path issue. try editing the script to use absolute paths as cron may have different $PATH settings that your user session has. So instead of just “transmission-remote”, change it to “/usr/bin/transmission-remote” (on my system that is the absolute path, to determine yours, you can use which: which transmission-remote to get the path. -- concerned citizen
Nice little script but I found it not working as I expected. I consider a torrent incomplete until it has seeded the seed ratio specified for the torrent(s). This script remove the torrent as soon as it has downloaded 100%. I find it more appropriate to remove each torrent when the status is set to “Finished” instead. -- Björn Lindahl
Hey Bjorn, Thanks for your comment. The script is running for a while at my Raspberry Pi and it’s doing fine. Indeed, you can argue about what’s more appropriate to do, keep seeding after the download has finished of removing the the torrent as soon as it finishes downloading. What you want can also be achieved using the script. You only have to change the grep search string. I hope this helps you to modify the script to match your needs. -- Pieter Bogaerts