Skip to content

mongoshield schedule

Run backups on the configured cron schedule (long-running).

Terminal window
mongoshield schedule [options]

Runs the scheduled job (lock, backup, verify, prune, notify) at every slot of schedule.cron, until stopped with SIGTERM or Ctrl-C. Several replicas may run it: the lock makes sure only one backs up per slot.

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.
--cron <expression>Override schedule.cron, e.g. "15 3 * * *".
--timezone <iana-zone>Override schedule.timezone (default: UTC).
--grace-seconds <n>On shutdown, how long a running backup may take to finish before it is aborted. Default: 60.

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

Use the schedule from mongoshield.config.ts:

Terminal window
mongoshield schedule

Every night at 03:15 Berlin time:

Terminal window
mongoshield schedule --cron "15 3 * * *" --timezone Europe/Berlin