Skip to content

mongoshield run

Run the scheduled job once: lock, back up, verify, prune, notify.

Terminal window
mongoshield run [options]

Does what mongoshield schedule does on each tick, once, using the schedule, retention, guard, notify and heartbeat sections of mongoshield.config.ts. Made for system cron, Kubernetes CronJobs, CI and serverless schedulers. Exits 0 when another runner holds the lock (the run is skipped).

OptionDescription
--uri <mongodb-uri>Connection string (default: config source.uri, MONGOSHIELD_URI or MONGODB_URI).
--to <storage-url>Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config).
--identity-file <path>age identity file for encrypted backups (from mongoshield keygen). Repeatable.
--passphrase-env <VAR>Read the encryption passphrase from this environment variable.
--verify <none|fast|deep|drill>Override schedule.verify (default: fast; drill needs the drill section).
--no-pruneDo not prune, whatever schedule.prune says.
--jitterWait a random 0–schedule.jitterSeconds before starting.

The global options (--config, --json, --quiet, --verbose, --no-color, --yes) work here too.

Run the configured job now:

Terminal window
mongoshield run

From crontab, every night at 03:15, with a deep verify:

Terminal window
15 3 * * * mongoshield run --verify deep --quiet