Skip to content

Back up SQLite in a scheduled job

Run the foreground command on the host that holds the SQLite files, using the same credentials as the scheduled task.

For a recurring schedule on fresh workers, choose Multiple machines in Machines → Add machine. A successful join spends one token use for the entire glob, even if a file later fails. A previously joined session reuses its saved identity.

litebackup backup '/data/exports/**/*.sqlite' scheduled/ --timeout 30m

Each matched file takes its writer lock, captures committed SQLite pages and waits for acknowledgement. A failed file produces an error and the job continues with other matches. A nonzero exit means the job failed. An overlapping writer gets busy. Files already published remain available to restore.

import { Litebackup } from "@litebackup/sdk";

const litebackup = new Litebackup();

await litebackup.backups.once("/data/exports/**/*.sqlite", {
  prefix: "scheduled/",
  timeout: "30m",
});

A job exits nonzero when no files match or any file fails. The foreground process exits after cleanup. Use litebackup start for applications that need ongoing listing and uploads.

Runnable TypeScript example · Cron · Temporal

SDK guides · Source on GitHub