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.
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
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.
Monitor and clean any number of Transmission instances from a single container. Servers are listed in a servers.json file that accepts comments.
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.
Any cron expression, evaluated in the timezone you set with TZ. The dashboard counts down to the next run.
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.
See what would be deleted without touching anything: from the dashboard with one click, or for every run with DRY_RUN=true.
Telegram, Resend and SMTP, each enabled on its own and sent in parallel. By default only when something was deleted or failed.
Every effective run is stored in a SQLite database and searchable from the /history page. Dry runs are never stored.
Coming from the old script? Import its emailed .eml reports into the same history, deduplicated by Message-ID.
/api/status, /api/torrents and /api/history return JSON for scripts and dashboards; POST /run starts a cleanup or a dry run.
Multi-arch images (amd64, arm64) on Docker Hub and GHCR, with a built-in healthcheck on /api/status. No Python needed on the host.
On every run, each torrent on each server goes through the same checks. It is removed only if it passes all of them.
Torrents that are downloading, checking or queued are skipped.
An incomplete download is never removed, whatever its age.
Its age is at least DAYS_TO_WAIT days (10 by default).
If MIN_RATIO is above 0, its upload ratio must reach it. With 0 this check is off.
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.
All you need is Docker and network access to each Transmission RPC endpoint. Official images are published for every release:
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 -d \ --name transmission-cleaner \ --restart unless-stopped \ -p 8080:8080 \ -v "$(pwd)/config:/config" \ --env-file stack.env \ gfsolone/transmissioncleaner:latest
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.
Everything below is also in the README.
9091)No Python installation is needed on the host.
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"}]
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.
| Variable | Default | Description |
|---|---|---|
DAYS_TO_WAIT | 10 | Delete torrents that have been seeding or stopped for at least this many days. |
MIN_RATIO | 0 | Minimum upload ratio required before deletion. 0 disables the check. |
CLEANUP_SCHEDULE | 0 6 * * * | Cron expression for the automatic run (every day at 06:00). |
TZ | UTC | IANA timezone (e.g. Europe/Rome) used for the schedule and for the times shown in the dashboard. |
DRY_RUN | false | If true, every run only logs what would be deleted. |
NOTIFY_ALWAYS | false | Send a report on every run, not only when something was deleted or failed. |
SERVERS_FILE | /config/servers.json | Path of the servers file inside the container. |
TRANSMISSION_SERVERS | — | Inline JSON list of servers, used only when SERVERS_FILE doesn't exist. |
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.CLEANUP_SCHEDULE takes a standard five-field cron expression:
| Expression | Meaning |
|---|---|
0 6 * * * | Every day at 06:00 (default) |
50 7 * * 3 | Every Wednesday at 07:50 |
0 3 * * * | Every day at 03:00 |
0 6 * * 1 | Every Monday at 06:00 |
0 */6 * * * | Every 6 hours |
30 22 * * * | Every day at 22:30 |
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.
| Variable | Default | Description |
|---|---|---|
TELEGRAM_ENABLED | false | Enable Telegram notifications. |
TELEGRAM_BOT_TOKEN | — | Bot token from @BotFather. |
TELEGRAM_CHAT_ID | — | Target chat, group or channel ID. |
/newbot and follow the prompts. The token it gives you goes in TELEGRAM_BOT_TOKEN.https://api.telegram.org/bot<TOKEN>/getUpdates and look for "chat":{"id": ...}.Resend is a transactional email API with a free tier.
| Variable | Default | Description |
|---|---|---|
RESEND_ENABLED | false | Enable 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. |
Your own mail server, a relay, or a provider such as Gmail, Fastmail or Mailgun.
| Variable | Default | Description |
|---|---|---|
SMTP_ENABLED | false | Enable SMTP notifications. |
SMTP_HOST | localhost | SMTP server hostname. |
SMTP_PORT | 25 | SMTP port. |
SMTP_USER | — | Username; leave empty if not required. |
SMTP_PASSWORD | — | Password. |
SMTP_FROM | — | Sender address. |
SMTP_TO | — | Recipient address. |
SMTP_TLS | false | true 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
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
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.
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.
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
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.
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.
| Button | Action |
|---|---|
| Run cleanup now | Runs the full cleanup immediately and sends notifications. |
| Dry run | Marks what would be deleted. Nothing is removed and no notification is sent. |
| Refresh | Reloads the page and queries all servers again. |
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.
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.
| Endpoint | Method | Description |
|---|---|---|
/ | GET | Web dashboard (HTML). |
/run | POST | Start a cleanup; ?dry=1 for a dry run. |
/api/status | GET | Scheduler and last-run metadata (JSON). |
/api/torrents | GET | Every torrent per server, with its will_delete verdict (JSON). |
/history | GET | Searchable cleanup history (HTML). |
/api/history | GET | Paginated 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"
POST /run deletes torrents. Keep port 8080 on a trusted network, or publish it behind an authenticating reverse proxy.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)"
localhost or 127.0.0.1: inside the container they point to the container itself./start.curl "https://api.telegram.org/bot<TOKEN>/sendMessage" \ -d chat_id=<CHAT_ID> \ -d text="test"
TRANSMISSION_SERVERS parsing errorThe value must be valid JSON. Common mistakes: single quotes inside the JSON, trailing commas, missing brackets.
docker logs -f transmission-cleaner
No. Only seeding or stopped torrents that are 100% complete are candidates, and only once they pass the age (and, if set, ratio) threshold.
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.
Press Dry run on the dashboard, or set DRY_RUN=true so every run, scheduled ones included, only reports what it would do.
The container defaults to UTC. Set TZ to your IANA timezone, for example TZ=Europe/Rome.
Yes. Telegram, Resend and SMTP are independent; enable any combination and each report goes to all of them.
Yes, as long as /config is mounted from the host: cleanups.db lives there alongside servers.json.