Skip to content

Running AutoMiner: upgrades, backups, disk

This page covers looking after a running AutoMiner: where its data lives, the service, upgrades, backups, disk space, resetting, moving to another machine and reaching it from other devices. For the first install, see install.md (Linux and macOS) or install-windows.md. Every command is listed in cli.md, and troubleshooting.md covers things going wrong.

Run every autominer command below as the same user the service runs as (with sudo for an install done as root). The data directory depends on the user, so a command run as someone else looks at a different, empty one.

Everything AutoMiner keeps is in one data directory, AUTOMINER_HOME:

How you installed Data directory
install.sh as root (a system service) /var/lib/autominer
install.sh as a normal user (a user service), and on macOS ~/.local/share/autominer (or $XDG_DATA_HOME/autominer)
The Windows installer %LOCALAPPDATA%\AutoMiner\data
AUTOMINER_HOME set in the service’s environment that path

To check which one a running server uses, the first line of autominer doctor names it (AUTOMINER_HOME: <path>), and http://<server>:8801/healthz reports the database path as "db".

Inside it:

Path What it holds
autominer.db (with autominer.db-wal and autominer.db-shm beside it while it runs) The database: every source, watch, candidate, setting, the known-word cache, the job queue and the spend records. Settings from the Settings page are rows here.
secrets/ One file per API key or password (the directory is mode 0700, each file 0600). Keys are never stored in the database.
library/ Media made from your sources: clips/, shots/ (screenshots), thumbs/, audio/, contexts/, subs/, frames/, peaks/ (waveforms), artwork/ and trash/ (deleted clips).
library/MineSrc/ Downloaded source videos and podcast audio, in YT/, Stremio/ and Podcast/. This is what grows fastest.
models/ The speech detector (silero_vad.onnx), a separation model, and whisper/ when audio is transcribed on this machine.
judge/ This machine’s judge model, once downloaded.
yomitan/ The built-in Yomitan’s data, with dictionaries/ for dictionaries to import.
programs/ Programs a platform installed, such as YouTube’s yt-dlp in programs/youtube/. Uninstalling the platform deletes its folder.
torrents/ Deluge’s downloads for Stremio. AutoMiner removes them once no job needs them.
cache/, state/ Cached lookups and the Stremio and Spotify trackers’ state.
env/ Service files rendered from an installation .env, only if you render them (see Backups).
known-garbage.csv The known-word CSV, if you uploaded one.
logs/ Windows only: autominer.log.

The code lives in your checkout (or %LOCALAPPDATA%\Programs\AutoMiner on Windows), apart from the data. An installation .env, if you made one with autominer setup, sits in the checkout’s root.

The database and the secrets directory hold your settings, keys and history, and the .env holds any server settings you made. The built-in Yomitan keeps its dictionaries and its own options (dictionary order, card formats) in yomitan/. The library is large: its clips and screenshots are cut from your sources, so they can be made again only while a source’s video is still there or can be fetched again.

Single paths can be moved with their own settings: AUTOMINER_DB, AUTOMINER_LIBRARY_ROOT, AUTOMINER_SECRETS_DIR, and AUTOMINER_SOURCES_ROOT for keeping downloaded videos on a NAS. See configuration.md.

install.sh registers a service that starts by itself (at boot for a root install, at login for a user install and on macOS) and listens on port 8801 on every network interface (set AUTOMINER_PORT before running install.sh for another port).

systemd, installed as root (unit /etc/systemd/system/autominer.service):

Terminal window
sudo systemctl status autominer
sudo systemctl stop autominer
sudo systemctl start autominer
sudo systemctl restart autominer
sudo journalctl -u autominer -f # the log, following

systemd, installed as a normal user (unit ~/.config/systemd/user/autominer.service):

Terminal window
systemctl --user status autominer
systemctl --user restart autominer
journalctl --user -u autominer -f
loginctl enable-linger $USER # keep it running while you are logged out

Without linger, a user service stops when you log out.

macOS (launchd agent com.autominer.core): it starts when you log in and is restarted if it stops.

Terminal window
launchctl unload ~/Library/LaunchAgents/com.autominer.core.plist # stop
launchctl load ~/Library/LaunchAgents/com.autominer.core.plist # start

The agent keeps no log file. To see the output, stop it and run autominer serve --host 0.0.0.0 --port 8801 in a terminal.

Windows: AutoMiner in the Start menu starts it and opens the browser. With “Start AutoMiner when I sign in to Windows” ticked at install, it starts in the background at each sign-in. It listens on this PC only (http://127.0.0.1:8801). There is no stop button: to stop it, end the pythonw.exe process in Task Manager (its path is under %LOCALAPPDATA%\Programs\AutoMiner). The log is %LOCALAPPDATA%\AutoMiner\data\logs\autominer.log.

Checking health. autominer doctor prints every feature as configured, not configured or misconfigured, and where each value comes from (never the value). It exits 0 when healthy. curl http://<server>:8801/healthz answers "ok": true with the version, the database path and the number of queued jobs.

Stopping mid-job. Stopping while a job runs is safe. At the next start that job is resumed or marked failed, and a failed one can be run again from its source. autominer maintenance status shows the work in progress before you stop.

The audio services you run on another machine (transcription, separation) have their own installers and services: see self-host.md.

Terminal window
cd <checkout>
git pull
sh install.sh # --no-packages skips the system package manager
sudo systemctl restart autominer # or: systemctl --user restart autominer

Re-running install.sh updates the program in the checkout’s core/.venv, downloads the built-in Yomitan’s files when the version it pins has changed, and rewrites the service file. On systemd it does not restart a server that is already running, so restart it yourself. On macOS it reloads the agent, which restarts it.

Make a backup first. The database is upgraded in place when the new version starts: missing tables and columns are added and one-time data changes run. There is no separate step.

Run the newer AutoMiner-Setup-<version>.exe. It closes AutoMiner, replaces the program and keeps your data (install-windows.md).

A database last started by a version older than commit 7f134861 (2026-11-05) is refused at startup. The service does not start, and its log has a line that begins:

[startup] REFUSED: This database needs the one-time upgrades from version 7f1348616fc1d4c042e410483b83e448032f3e9d — start that version once, then this one.

install.sh came later than that commit, so this affects only older manual installs. The README’s Upgrading from an older release says the same in short.

That older version runs one-time upgrades the current one no longer carries. To get through:

  1. Stop AutoMiner and back up the database.
  2. git checkout 7f134861 in the checkout, and install that version into the venv (cd core && uv pip install -p .venv/bin/python -e ".[vad]").
  3. Start it and wait until http://<server>:8801/healthz answers. Then stop it.
  4. git checkout master, run sh install.sh, and restart.

What to keep a copy of:

What Why
autominer.db All history and settings.
secrets/ Your API keys and passwords. The database backup below does not include them.
The installation .env Server settings, if you use one.

Notes already in Anki are in your Anki collection, with their audio and pictures, and are backed up by Anki, not by AutoMiner.

The database can be copied safely while AutoMiner runs with SQLite’s backup, which is what the nightly backup uses too:

Terminal window
<checkout>/core/.venv/bin/python -c "import sqlite3; sqlite3.connect('<data dir>/autominer.db').backup(sqlite3.connect('<backup dir>/autominer-copy.db'))"

Don’t copy autominer.db with cp while the server runs: recent changes may still be in autominer.db-wal and the copy can be inconsistent. With the server stopped, copying the file is fine.

scripts/operations/backup_db.py takes a consistent snapshot of the database and copies it over SSH to another machine as autominer-YYYY-MM-DD.db. It checks the copy’s size, then keeps only the newest snapshots. It copies the database only.

Setting Default What it does
AUTOMINER_BACKUP_SSH_HOST blank: backup off The machine that receives the snapshots.
AUTOMINER_BACKUP_SSH_USER ssh’s default The login on it.
AUTOMINER_BACKUP_SSH_KEY ssh’s default keys The SSH key file to log in with.
AUTOMINER_BACKUP_REMOTE_DIR autominer-backups The folder on it, relative to the login’s home unless absolute. No single quotes.
AUTOMINER_BACKUP_KEEP 14 How many dated snapshots to keep there (at least 1).

The backup machine needs:

  • a login with an SSH key and no password prompt (the script runs ssh in batch mode);
  • a Linux shell with GNU tools: the script runs mkdir, cat, stat -c, ls, sort, head -n -N and xargs -r there.

To set it up:

  1. Run autominer setup, answer y to “Enable Off-host DB backup (SSH)?” and fill in the host, user, key and folder. This writes them into the installation .env in your checkout. autominer config set AUTOMINER_BACKUP_KEEP 30 changes the number kept.

  2. Render the .env into the data directory’s env/ folder:

    Terminal window
    cd <checkout>
    python3 scripts/operations/configure_env.py --input .env --output-dir <data dir>/env

    This writes <data dir>/env/backup.env, which the backup reads, and which tells Settings › Upkeep that the backup is set up.

  3. Run it once by hand to check it:

    Terminal window
    set -a; . <data dir>/env/backup.env; set +a
    <checkout>/core/.venv/bin/python <checkout>/scripts/operations/backup_db.py

    It prints backup ok: <folder>/autominer-<date>.db (<n> bytes), or the reason it failed.

  4. Run it every night. See Scheduling the nightly jobs.

With no host set, the script prints “backup not configured” and exits 0. With a user, key or folder set but no host, it exits 1.

Checking it. Settings › Upkeep › Backup shows “Last backup:” with the date, time and size of the last good run. After a failed run, or 48 hours without a success, the line turns orange with the reason. Before the first run it says “Not run yet (it runs every night)”, or “No destination set” while the server can’t see a host in env/backup.env.

  1. Fetch the snapshot you want, for example scp <user>@<backup-host>:autominer-backups/autominer-<date>.db .
  2. Stop AutoMiner.
  3. In the data directory, move autominer.db, autominer.db-wal and autominer.db-shm out of the way. Leaving an old -wal file beside a restored database can damage it.
  4. Copy the snapshot in as autominer.db, owned by the user the service runs as.
  5. If you are restoring onto a fresh machine, put secrets/ back too, keeping it mode 0700 and its files 0600.
  6. Start AutoMiner.

Anything AutoMiner recorded after the snapshot is gone from it. Notes you sent to Anki in the meantime stay in Anki; press Update known words (Settings › Languages) so the known-word cache catches up.

What takes space, roughly in order:

What Where How it shrinks
Downloaded videos and podcast audio library/MineSrc/ The retention sweep, below, or a source’s Delete video on the Sources page (sources.md). YouTube videos are fetched at up to 720p.
Audio tracks, frames, clips, screenshots, waveforms the rest of library/ Deleting a source. These stay when a video is deleted, so clips can still be cut again.
Dictionaries yomitan/ and the database Remove dictionaries in Settings › Languages. Yomitan’s recommended Japanese set is about 800 MB once imported.
Models models/, judge/ Delete the judge model in Settings › Services. The on-machine Whisper model is about 1.6 GB, downloaded on first use.
Deluge downloads torrents/ Removed by AutoMiner once no job needs them.

Free space. Overview › How a card gets made shows a “Free space” stage. It turns red when less than 2 GB is free on the data disk, or on the sources store if you keep downloads on a separate one. Settings › Sources › Media retention shows free space, how much the kept videos take and what the next clean-up would delete.

The sweep deletes downloaded source videos by the rules in Settings › Sources › Media retention (settings.md):

  • a mined video older than Days kept (10 days by default, per platform if you set an override) since it was fetched;
  • with Delete once assets are done ON (the default), also a video whose candidates all have their clip and picture, without waiting for Days kept.

It never deletes a video that was never mined, one that is playing or being worked on, one another source in the queue still uses, or a file outside library/MineSrc/ (and outside the sources store, if you set one). A video whose audio track and frames aren’t saved yet waits until they are. It deletes only the video file: subtitles, candidates, clips, screenshots and the audio track stay. A deletion can’t be undone.

The sweep runs only when something asks for it:

Terminal window
autominer retention-sweep # dry run: lists what would go and how much space it frees
autominer retention-sweep --commit # queues the sweep; the running server carries it out

install.sh does not schedule it. The Media retention card describes a nightly run, but until you schedule autominer retention-sweep --commit yourself, no video is ever deleted by these settings. See Scheduling the nightly jobs. The Windows app does not run it either; delete videos per source from the Sources page there.

Where What it does
Settings › Sources › Media retention › Advanced › Keep deleted clips (min) A deleted clip’s files stay in library/trash/ this many minutes (60 by default, up to a week) so it can be restored, then they are removed. AutoMiner does this by itself.
Settings › Languages › Junk candidates (all languages) Check junk candidates, then Delete junk candidates: removes candidates mined automatically, never sent or decided, whose word fails the language’s word check or whose sentence is too long.
Settings › Upkeep › Advanced › Session clean-up Check sessions, then Close old sessions: closes watch sessions idle for 6 hours or more (closed tabs can leave them “playing”). Recorded watch time doesn’t change. The same from the command line: autominer session-sweep --commit.
Settings › Sources › Platforms Uninstalling a platform deletes the files it downloaded. Its sources, clips and cards stay.

Two jobs are worth running every night: the retention sweep and, if you set it up, the backup. Use cron, or a systemd timer where there is no cron.

cron (crontab -e as the service’s user, or sudo crontab -e for a root install):

20 4 * * * set -a; . <data dir>/env/backup.env; set +a; <checkout>/core/.venv/bin/python <checkout>/scripts/operations/backup_db.py >> <data dir>/backup.log 2>&1
50 4 * * * <checkout>/core/.venv/bin/autominer retention-sweep --commit >> <data dir>/retention.log 2>&1

systemd (root install; for a user install, put the files in ~/.config/systemd/user/ and use systemctl --user). /etc/systemd/system/autominer-retention.service:

[Unit]
Description=AutoMiner retention sweep
After=autominer.service
[Service]
Type=oneshot
ExecStart=<checkout>/core/.venv/bin/autominer retention-sweep --commit

/etc/systemd/system/autominer-retention.timer:

[Unit]
Description=Nightly AutoMiner retention sweep
[Timer]
OnCalendar=*-*-* 04:50:00
Persistent=true
[Install]
WantedBy=timers.target
Terminal window
sudo systemctl daemon-reload
sudo systemctl enable --now autominer-retention.timer

A backup timer is the same with EnvironmentFile=-<data dir>/env/backup.env and ExecStart=<checkout>/core/.venv/bin/python <checkout>/scripts/operations/backup_db.py. The checkout’s deploy/ folder has both pairs of units ready made, but they expect the checkout at /opt/AutoMiner and the data in /var/lib/autominer, and the retention unit also needs a rendered env/autominer.env.

The sweep only queues its work, so the AutoMiner service must be running at that time.

Warning: a reset can’t be undone. Make a backup first.

Settings › Upkeep › Advanced › Reset database empties AutoMiner while keeping its setup. Check what goes counts the sources, candidates, clips, sessions and the space the videos take. Delete all asks you to type Delete all (すべて削除 in the Japanese UI), then:

Deleted Kept
Every source and its subtitles and alignment Every setting on the Settings page
Every candidate, clip, screenshot and downloaded video API keys (secrets/)
Watch history: sessions, intervals and raw events The known-word cache
OK / NG clip feedback Dictionaries
The record of which candidate became which Anki note Installed platforms
Every job, queued or done Spend records (no longer tied to a source)
The library folders: clips, shots, thumbs, audio, contexts, subs, frames, peaks, trash, artwork Backups, and everything in Anki

The reset runs as a job and reports its progress on the card. A source whose video can’t be reached (a NAS store that isn’t mounted, for example) is kept, and the reset ends with an error naming how many were kept. Fix the cause and run it again.

To remove everything, settings and keys included: stop AutoMiner, then delete the data directory. To keep your keys, delete autominer.db, autominer.db-wal, autominer.db-shm and library/ instead. The next start makes a new, empty database and opens on the setup page.

On Windows, uninstalling keeps %LOCALAPPDATA%\AutoMiner\data; delete that folder yourself to remove your data.

AutoMiner records clips, screenshots and downloaded videos by their full path. Put the data directory at the same path on the new machine: install as the same kind of user (both root, or the same user name), or set the same AUTOMINER_HOME. Moved anywhere else, including to another operating system, those files are no longer found. Cards in Anki are not affected either way.

  1. On the new machine, clone the repository and run sh install.sh --no-service.

  2. On the old machine, stop AutoMiner.

  3. Copy the whole data directory across, keeping permissions, for example as root:

    Terminal window
    rsync -a /var/lib/autominer/ root@<new-server>:/var/lib/autominer/

    Copy the installation .env from the checkout too, if you have one.

  4. On the new machine, run sh install.sh --no-packages to register and start the service.

  5. Run autominer doctor, and open Settings › Services to test each address.

  6. Point everything that talks to the server at its new address: the Chrome extension’s popup, the phone patch (phone-youtube.md), and any audio services that ran on 127.0.0.1. If Anki’s address as seen from the new server is different, save it in Settings › Services › AnkiConnect URL (anki.md).

Don’t leave the old server running with the same accounts: both would track the same Stremio and Spotify accounts. If you need it running, start it with AUTOMINER_TRACKING=0 so it runs no tracker.

The Chrome extension, the phone patch and your browser all talk to the server over HTTP on port 8801. AutoMiner has no login: anyone who can reach the port can use every page, change every setting, replace or delete your keys and run Reset database. Keep it on your home network or a private network such as a Tailscale tailnet, or put a login in front of it.

On your LAN. Use http://<server>:8801 everywhere, with the server’s LAN address or name.

On a tailnet. Install Tailscale on the server and on your devices, and use the server’s tailnet address, http://<server-tailnet-name>:8801, in the extension, the phone patch and your browser. The server must also reach Anki on your computer, by that computer’s tailnet address (anki.md). The audio services have no login either; keep them on the LAN or tailnet too (self-host.md).

Behind a reverse proxy. A proxy in front of port 8801 works with these limits:

  • Serve AutoMiner at the root of its own host name (https://autominer.<your-domain>/), not under a sub-path. The pages load /static/… and call /v1/… from the root.
  • Plain HTTP proxying is enough: AutoMiner uses no WebSockets or server-sent events.
  • Allow large request bodies, or dictionary imports (.zip) fail. In nginx that is client_max_body_size.
  • Put the login at the proxy, since AutoMiner has none. Check afterwards that the Chrome extension and the phone patch still get through; they are simplest to point at the direct LAN or tailnet address.

The Windows app listens on 127.0.0.1 only, so other devices can’t reach it.