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).

Preferences, Plugins: Execute ticked, Apply and the new page Execute

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.

Add Command: the event Torrent Complete, the command and Add

The command is now in the list (1). Click OK (2).

Execute: the command for Torrent Complete and OK

4. Restart Deluge Once

Deluge starts using a new command after a restart. Stop Deluge from its own window first, so that Execute also stays switched on after the restart:

  1. Click Connection Manager in the toolbar, select the line of your service and click Stop Daemon.
  2. In the Client Area, open the Apps tab and click RESTART at Deluge. Then reload the Deluge page; sign in again if it asks for your password.

Pictures of these steps are in Deluge: Install a Plugin From Another Author, step 6. Do the same after you add commands later.

⚠ Do not switch Execute off and on instead

Each time you untick and tick Execute, Deluge runs your command once more for every torrent, until its next restart.

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; this works at once. Unticking Execute under Plugins does not stop it: Deluge keeps running the command until it is restarted.
  • 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.
Was this answer helpful? 0 Users Found This Useful (0 Votes)