With its plugin Execute, Deluge can start a script of your own every time a torrent finishes. The script gets the ID, the name and the download folder of the torrent. Use it, for example, to keep a list of finished downloads or to copy files elsewhere. The steps were tested with Deluge 2.2.0 on our demo service.
Deluge basics: Deluge: Add and Manage Torrents in Your Browser. Connecting with SSH: SSH how to get connected.
1. Write the Script
Connect over SSH, create a folder for your scripts and open a new script in the editor nano:
mkdir -p ~/scripts nano ~/scripts/deluge-done.sh
This example writes one line per finished torrent into ~/scripts/finished.log:
#!/bin/sh # Deluge passes: $1 = torrent ID, $2 = name, $3 = download folder echo "$(date "+%Y-%m-%d %H:%M:%S") finished: $2 | $3" >> "$HOME/scripts/finished.log"
Save with Ctrl+O and Enter and close with Ctrl+X. Then allow the script to run:
chmod +x ~/scripts/deluge-done.sh
2. Switch On Execute
In Deluge, click Preferences at the top and choose Plugins. Tick Execute (1) and click Apply (2). Execute then appears in the list on the left (3).
3. Add the Command
Choose Execute on the left and click Add at the bottom. In the window Add Command, choose the event Torrent Complete (1), enter the full path of your script under Command (2), for example /homeX/username/scripts/deluge-done.sh, and click Add (3). Over SSH, echo ~/scripts/deluge-done.sh shows the whole path of your script.
The command is now in the list (1). Click OK (2).
4. Switch Execute Off and On Once
Open Preferences → Plugins again, untick Execute and click Apply, then tick it again and click Apply. Do the same after you add commands later.
5. Test It
Add a small torrent and wait until it is finished. The script then writes a line like this into finished.log:
2026-11-30 02:22:22 finished: debian-13.8.0-arm64-netinst.iso | /homeX/username/downloads
Good to Know
- The script runs with the rights of your own account, like Deluge itself.
- The events Torrent Added and Torrent Removed work the same way.
- To stop the script, select the command under Execute, click Remove and OK, or untick Execute under Plugins.
- If no line appears, check the path of the script, that you ran
chmod +x, and step 4. - The same for qBittorrent: qBittorrent: Run Your Own Script When a Download Finishes.


