Jump to content

Shutdown uTorrent on download completion


Recommended Posts

Hi there,

Is there a way to set in the config file for uTorrent to exit / Shutdown itself once all downloads have completed? I am running uTorrent on my Asustor NAS and access it only through the WebGUI. I know that the desktop interface has the option you can set manually each time, but I was wondering if there is something that could be scripted for this situation.


Link to comment
Share on other sites


There are a couple ways you could accomplish what you want. As you're aware, there isn't a setting for utserver to exit itself when all downloads are complete.

However, there is functionality to run a command when each torrent finishes or when each torrent changes status. You could rig a script up to these run commands to kill utorrent, but you'd have to keep track of how many torrents you've set to download beforehand.

A better way may be to set up a watchdog script that connects through the WebUI API to check the status of all the torrents and issuing a kill utserver command when they're all done.

The simplest option would be to not exit utserver, but to keep it running. You would configure appropriate seed ratio/limits so that once a threshold is reached you're no longer downloading/uploading. The resource usage of utserver at idle is fairly low.

This option may also be more ideal because then you could utilize the "Automatically load .torrents from" setting to autoload torrents placed in the specified directory on your NAS without having to start utserver each time.

Link to comment
Share on other sites

  • 3 months later...

Hi, I tried this and it works great.


Firstly add maintenace directory. See pdf document in docs


...dir_request (string): Default value: "". Directory where maintenance request
files will be recognized, loaded, and deleted. If the empty string, maintenance request handling is disabled...
...If the file sp.utmr is created in or moved into this directory, the utserver process will exit after performing normal shutdown processing such as
saving settings files and torrent resume data...
Then create directory structure for scripts and a 'busy' directory like below.
Then I use two very very basic scripts.
## I have it in /opt/utorrent-server/scripts/change
touch /opt/utorrent-server/scripts/busy/$1
exit 0
## I have it in /opt/utorrent-server/scripts/fin
sleep 10 # If first torrent was very small liked the one I tested
rm -f /opt/utorrent-server/scripts/busy/$1
cnt=`ls /opt/utorrent-server/scripts/busy -1 | wc -l`
if [ $cnt -eq 0 ]
touch /home/user/data/maintenance/sp.utmr
#server will shut down here
exit 0
remember to make them executable chmod +x /script_name
I then run the scripts in the 
Run Program section
Run this program when a torrent finishes:
/opt/utorrent-server/scripts/fin %N
Run this program when a torrent changes state:
/opt/utorrent-server/scripts/change %N
Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...