Your torrents can
clean themselves up

Transmission Cleaner removes finished torrents from one or more Transmission servers once they have seeded long enough, optionally only after reaching a minimum ratio. Self-hosted in Docker, with a web dashboard, dry runs, cleanup history and notifications.

Get started Read the docs View on GitHub
Transmission Cleaner — 2026-11-30 06:00:01
Rules: retain 10 days · min ratio 1.0

=== S1 (192.168.1.10) ===
Removed: Ubuntu 24.04 LTS       | age: 15d | ratio: 1.52
Removed: Debian 13 netinst      | age: 21d | ratio: 2.07
Kept:    Fedora 43 Workstation  | age:  3d | ratio: 0.21

=== S2 (nas.local) ===
Kept:    Arch Linux 2026.11.01  | age: 12d | ratio: 0.64  # ratio below 1.0

2 torrents removed · 0 errors · next run: tomorrow 06:00
–Latest release
–Docker pulls
–Docker image size
–GitHub stars

Finished downloads shouldn't become furniture

A busy Transmission instance quietly piles up completed torrents, fills storage and hides what needs attention. Transmission Cleaner gives that chore a schedule, a policy you can preview, and an audit trail.

Multiple servers

Monitor and clean any number of Transmission instances from a single container. Servers are listed in a servers.json file that accepts comments.

Rule-based deletion

A torrent goes only when it is seeding or stopped, fully downloaded, older than DAYS_TO_WAIT and, if you set one, above MIN_RATIO. Incomplete downloads are never touched.

Scheduled runs

Any cron expression, evaluated in the timezone you set with TZ. The dashboard counts down to the next run.

Web dashboard

A live table of every torrent on every server, with a Delete or Keep badge per row, summary tiles, the active settings and the log of the last run. It refreshes every 60 seconds.

Dry runs

See what would be deleted without touching anything: from the dashboard with one click, or for every run with DRY_RUN=true.

Notifications

Telegram, Resend and SMTP, each enabled on its own and sent in parallel. By default only when something was deleted or failed.

Cleanup history

Every effective run is stored in a SQLite database and searchable from the /history page. Dry runs are never stored.

History importer

Coming from the old script? Import its emailed .eml reports into the same history, deduplicated by Message-ID.

REST API

/api/status, /api/torrents and /api/history return JSON for scripts and dashboards; POST /run starts a cleanup or a dry run.

Official Docker images

Multi-arch images (amd64, arm64) on Docker Hub and GHCR, with a built-in healthcheck on /api/status. No Python needed on the host.

Four checks, then a deliberate delete

On every run, each torrent on each server goes through the same checks. It is removed only if it passes all of them.

1

It's seeding or stopped

Torrents that are downloading, checking or queued are skipped.

2

It's 100% downloaded

An incomplete download is never removed, whatever its age.

3

It's old enough

Its age is at least DAYS_TO_WAIT days (10 by default).

4

It has given back enough

If MIN_RATIO is above 0, its upload ratio must reach it. With 0 this check is off.

5

Remove, record & notify

The torrent is removed from Transmission along with its downloaded data, the run is saved to the cleanup history, and the report goes to the notification channels you enabled.

Up and running in minutes

All you need is Docker and network access to each Transmission RPC endpoint. Official images are published for every release:

tags: latest · X.Y.Z · dev

Docker Compose

git clone https://github.com/gioxx/TransmissionCleaner.git
cd TransmissionCleaner

# Settings, servers and (optionally) the host port
cp stack.env.example stack.env
cp config/servers.json.example config/servers.json
cp .env.example .env
nano stack.env config/servers.json

# Start
docker compose up -d

The dashboard is available at http://localhost:8080. servers.json and the history database live in ./config, so they survive container updates.

Docker run

docker run -d \
  --name transmission-cleaner \
  --restart unless-stopped \
  -p 8080:8080 \
  -v "$(pwd)/config:/config" \
  --env-file stack.env \
  gfsolone/transmissioncleaner:latest

Update

docker compose pull
docker compose up -d   # config stays in ./config

Pin a release (gfsolone/transmissioncleaner:X.Y.Z) instead of latest to upgrade on your own schedule. Portainer setups are in the docs below.

Configure, run, review

Everything below is also in the README.

Requirements

  • Docker 24+ (or Podman with Docker Compose support)
  • Network access from the container to each Transmission RPC endpoint (default port 9091)

No Python installation is needed on the host.

Transmission servers

Servers are listed in a JSON file mounted into the container, at the path set by SERVERS_FILE (default /config/servers.json). The file accepts // and /* */ comments. Start from servers.json.example.

[
  {
    // Display name shown in the web UI and notifications
    "name": "S1",
    // Hostname or IP address of the Transmission instance
    "host": "192.168.1.10",
    // RPC port, optional (default 9091)
    "port": 9091,
    // Leave empty if authentication is disabled
    "user": "admin",
    "password": "secret"
  },
  {
    "name": "S2",
    "host": "nas.local",
    "port": 9091,
    "user": "admin",
    "password": "secret"
  }
]

If the file doesn't exist, the app falls back to the TRANSMISSION_SERVERS environment variable, which takes the same list as one line of JSON. It's handy for quick tests:

TRANSMISSION_SERVERS=[{"name":"Home","host":"192.168.1.10","port":9091,"user":"admin","password":"secret"}]

Cleanup rules

All settings are environment variables: put them in stack.env (start from stack.env.example), pass them with --env-file, or set them one by one with -e.

VariableDefaultDescription
DAYS_TO_WAIT10Delete torrents that have been seeding or stopped for at least this many days.
MIN_RATIO0Minimum upload ratio required before deletion. 0 disables the check.
CLEANUP_SCHEDULE0 6 * * *Cron expression for the automatic run (every day at 06:00).
TZUTCIANA timezone (e.g. Europe/Rome) used for the schedule and for the times shown in the dashboard.
DRY_RUNfalseIf true, every run only logs what would be deleted.
NOTIFY_ALWAYSfalseSend a report on every run, not only when something was deleted or failed.
SERVERS_FILE/config/servers.jsonPath of the servers file inside the container.
TRANSMISSION_SERVERS—Inline JSON list of servers, used only when SERVERS_FILE doesn't exist.
Removed torrents are deleted together with their downloaded data. Run a dry run first to see what would go.
Set TZ. Without it the container runs in UTC, so CLEANUP_SCHEDULE fires at UTC time and the "Next run" countdown is off from your local time.

Schedule

CLEANUP_SCHEDULE takes a standard five-field cron expression:

ExpressionMeaning
0 6 * * *Every day at 06:00 (default)
50 7 * * 3Every Wednesday at 07:50
0 3 * * *Every day at 03:00
0 6 * * 1Every Monday at 06:00
0 */6 * * *Every 6 hours
30 22 * * *Every day at 22:30

Notifications

Telegram, Resend and SMTP can be active at the same time; each report goes to all enabled channels in parallel. By default a report is sent only when at least one torrent was deleted or an error occurred; set NOTIFY_ALWAYS=true to get one on every run. Dry runs started from the dashboard don't send notifications.

Telegram

VariableDefaultDescription
TELEGRAM_ENABLEDfalseEnable Telegram notifications.
TELEGRAM_BOT_TOKEN—Bot token from @BotFather.
TELEGRAM_CHAT_ID—Target chat, group or channel ID.
  1. In Telegram, message @BotFather, send /newbot and follow the prompts. The token it gives you goes in TELEGRAM_BOT_TOKEN.
  2. For your personal chat ID, message @userinfobot.
  3. For a group or channel, add the bot as admin, send a message, then open https://api.telegram.org/bot<TOKEN>/getUpdates and look for "chat":{"id": ...}.

Resend

Resend is a transactional email API with a free tier.

VariableDefaultDescription
RESEND_ENABLEDfalseEnable Resend notifications.
RESEND_API_KEY—API key from the Resend dashboard.
RESEND_FROM—Sender address, on a domain verified in Resend.
RESEND_TO—Recipient address.

SMTP

Your own mail server, a relay, or a provider such as Gmail, Fastmail or Mailgun.

VariableDefaultDescription
SMTP_ENABLEDfalseEnable SMTP notifications.
SMTP_HOSTlocalhostSMTP server hostname.
SMTP_PORT25SMTP port.
SMTP_USER—Username; leave empty if not required.
SMTP_PASSWORD—Password.
SMTP_FROM—Sender address.
SMTP_TO—Recipient address.
SMTP_TLSfalsetrue for implicit TLS (SMTPS, port 465); false for plain or STARTTLS.

Gmail, with an App Password (two-factor authentication must be on):

SMTP_ENABLED=true
SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_USER=you@gmail.com
SMTP_PASSWORD=xxxx-xxxx-xxxx-xxxx
SMTP_FROM=you@gmail.com
SMTP_TO=you@gmail.com
SMTP_TLS=true

Web UI port

The host port is set with HOST_PORT in .env (default 8080), not in stack.env: Docker Compose reads .env to fill in the compose file, while env_file: only passes variables into the container and can't change the port mapping.

cp .env.example .env
# then, in .env:
HOST_PORT=8081

Running the app

Images are built for linux/amd64 and linux/arm64 and published on Docker Hub (gfsolone/transmissioncleaner) and the GitHub Container Registry (ghcr.io/gioxx/transmissioncleaner). Releases are tagged latest and with their version number; pushes to main are tagged dev for pre-release testing.

Docker Compose

The repository's docker-compose.yml pulls the image from GHCR, mounts ./config and adds a healthcheck:

services:
  transmission-cleaner:
    image: ghcr.io/gioxx/transmissioncleaner:latest
    # build: .   # uncomment to build from source instead
    container_name: transmission-cleaner
    ports:
      - "${HOST_PORT:-8080}:8080"
    volumes:
      - ./config:/config
    env_file:
      - stack.env
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/api/status')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

To build from source, uncomment build: . and run docker compose up -d --build.

Docker run, single server

For a quick test without a config file, pass the server inline:

docker run -d \
  --name transmission-cleaner \
  --restart unless-stopped \
  -p 8080:8080 \
  -e TRANSMISSION_SERVERS='[{"name":"Home","host":"192.168.1.10","port":9091,"user":"admin","password":"s3cr3t"}]' \
  -e DAYS_TO_WAIT=10 \
  -e CLEANUP_SCHEDULE="0 6 * * *" \
  -e TZ="Europe/Rome" \
  gfsolone/transmissioncleaner:latest

Portainer

From Stacks → Add stack, choose Web editor and paste:

services:
  transmission-cleaner:
    image: gfsolone/transmissioncleaner:latest
    container_name: transmission-cleaner
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - /opt/transmission-cleaner/config:/config   # servers.json goes here
    environment:
      SERVERS_FILE: "/config/servers.json"
      DAYS_TO_WAIT: "10"
      MIN_RATIO: "0"
      CLEANUP_SCHEDULE: "0 6 * * *"
      TZ: "Europe/Rome"
      DRY_RUN: "false"
      NOTIFY_ALWAYS: "false"

Add the notification variables from the tables above in the stack's Environment variables panel, or switch it to Advanced mode and paste the contents of stack.env.example. Bind-mount a host directory for /config so servers.json and the history database stay on the host and survive redeployments.

Dashboard

The dashboard at http://your-host:8080 shows the countdown to the next run, summary tiles (servers, torrents, to remove, keeping), the active settings and enabled notification channels, one table per server with each torrent's status, size, age, ratio and a Delete or Keep badge, and the log of the last run. Rows highlighted in red will be removed on the next run. The page refreshes every 60 seconds.

ButtonAction
Run cleanup nowRuns the full cleanup immediately and sends notifications.
Dry runMarks what would be deleted. Nothing is removed and no notification is sent.
RefreshReloads the page and queries all servers again.

Cleanup history

Every effective run (scheduled or manual) is saved in /config/cleanups.db, a SQLite database, and can be searched from the History page at /history or through /api/history. Dry runs are never stored. Include cleanups.db in your backups.

Importing old reports

The history importer reads plain-text .eml exports of the old Torrent deletion log emails and stores their date, full body, server and torrent details and deletion count in the same history. Imported entries are marked imported and deduplicated by Message-ID (or a file hash when that header is missing), so running an import twice adds nothing. It sends no notifications and reads one file or every .eml file in a directory.

With Docker Compose, copy the exports into the mounted config directory and run the importer inside the container:

mkdir -p config/import
cp /path/to/*.eml config/import/
docker compose exec transmission-cleaner \
  python scripts/import_history.py \
  --db /config/cleanups.db \
  /config/import

Add --dry-run to preview the files without writing to the history.

REST API

EndpointMethodDescription
/GETWeb dashboard (HTML).
/runPOSTStart a cleanup; ?dry=1 for a dry run.
/api/statusGETScheduler and last-run metadata (JSON).
/api/torrentsGETEvery torrent per server, with its will_delete verdict (JSON).
/historyGETSearchable cleanup history (HTML).
/api/historyGETPaginated cleanup history search (JSON).

Example response of GET /api/status:

{
  "next_run": "2026-12-01T06:00:00+01:00",
  "last_run": "2026-11-30T06:00:01.234567",
  "last_deleted": 3,
  "last_errors": 0,
  "schedule": "0 6 * * *",
  "dry_run": false
}

Start a cleanup from the command line:

curl -X POST http://your-host:8080/run
# Dry run
curl -X POST "http://your-host:8080/run?dry=1"
The web UI and API have no login, and POST /run deletes torrents. Keep port 8080 on a trusted network, or publish it behind an authenticating reverse proxy.

Troubleshooting

Cannot connect to Transmission

Check that the host is reachable from inside the container:

docker exec transmission-cleaner python -c \
  "import socket; socket.create_connection(('192.168.1.10', 9091), 3)"
  • If Transmission runs on the same Docker host, use the host's LAN IP, not localhost or 127.0.0.1: inside the container they point to the container itself.
  • If both containers share a Docker network, use the Transmission service name as the host.

Telegram notifications don't arrive

  • Start the bot by sending it /start.
  • For a group or channel, make sure the bot is an admin.
  • Test the bot directly:
curl "https://api.telegram.org/bot<TOKEN>/sendMessage" \
  -d chat_id=<CHAT_ID> \
  -d text="test"

TRANSMISSION_SERVERS parsing error

The value must be valid JSON. Common mistakes: single quotes inside the JSON, trailing commas, missing brackets.

Container logs

docker logs -f transmission-cleaner

FAQ

Can it delete something I'm still downloading?

No. Only seeding or stopped torrents that are 100% complete are candidates, and only once they pass the age (and, if set, ratio) threshold.

Does it delete the downloaded files too?

Yes. A removed torrent is deleted from Transmission together with its downloaded data. Move anything you want to keep out of the download folder first, and use a dry run to check exactly which torrents a run would remove.

How do I try it without deleting anything?

Press Dry run on the dashboard, or set DRY_RUN=true so every run, scheduled ones included, only reports what it would do.

Why does the schedule run at the wrong time?

The container defaults to UTC. Set TZ to your IANA timezone, for example TZ=Europe/Rome.

Can I use more than one notification channel?

Yes. Telegram, Resend and SMTP are independent; enable any combination and each report goes to all of them.

Is my history kept when I update the container?

Yes, as long as /config is mounted from the host: cleanups.db lives there alongside servers.json.