Script Execution on RTorrent Completion
I’ve been digging around the Internet looking for advice on setting up an automated torrenting system. It was a requirement for me to have rsync sync from my remote server to my local media server on torrent completion in rtorrent. I finally managed to troubleshoot my configuration and get it working so I figured I would compile some tips for those of you trying to set up something similar. Here’s how I went about getting RSync (or any other script) to execute on RTorrent completion.
Configuring rtorrent is as simple as editing your .rtorrent.rc file. However due to poorly updated man pages figuring out the syntax for this is rather difficult so let me give you an example of how to set up a script to run on torrent completion.
system.method.set_key = event.download.finished, send_home, "execute= /path/to/your/script.sh"
Simple put that command in at the bottom of your .rtorrent.rc and make sure there are no trailing spaces or new lines below it.
I’m running this on a headless server so I don’t always have a terminal session when executing commands. Therefor I will be using screen to keep the process running in it’s own terminal session after it executes. To do this you will need a specific flag for screen the syntax is as follows
screen -dmS *insert your command to put in a screen here*
If you need any more help or need help troubleshooting your usage case please feel free to contact me via a comment or e-mail. Hope this helped any of you that were stuck!