Skip to content

Automation

FlareXes edited this page Jun 19, 2026 · 1 revision

GitBack is designed to run unattended using standard schedulers such as cron, systemd timers, or CI/CD pipelines.

A typical backup workflow consists of:

gitback discover
gitback sync
gitback snapshot --force

Recommended Schedule

Most environments do not require continuous discovery.

A common approach is:

Discover    Daily
Sync        Hourly
Snapshot    Daily
Health      Daily

Example:

02:00  discover
02:15  sync
03:00  snapshot --force
03:15  health

Adjust schedules based on repository activity and recovery requirements.

Cron

Example cron schedule:

0 2 * * * gitback discover
15 2 * * * gitback sync
0 3 * * * gitback snapshot --force
15 3 * * * gitback health

This:

  • Refreshes repository and Gist inventories
  • Synchronizes mirrors
  • Creates a daily snapshot
  • Produces a health report

systemd

Example service:

[Unit]
Description=GitBack Sync

[Service]
Type=oneshot
ExecStart=/usr/local/bin/gitback sync

Example timer:

[Unit]
Description=Run GitBack Sync

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target

Enable:

systemctl enable --now gitback-sync.timer

CI/CD

GitBack can also run from:

  • GitHub Actions
  • GitLab CI
  • Jenkins
  • Buildkite
  • Other CI/CD systems

Example workflow:

gitback discover
gitback sync
gitback snapshot --force

Store snapshots on persistent storage rather than ephemeral runners.

Health Monitoring

Regularly review:

gitback health

Monitor for:

  • Failed repositories
  • Failed Gists
  • Low disk space
  • Snapshot retention warnings

Health reports are intended to provide early warning before backups become unusable.

Logging

GitBack produces structured JSON logs.

Default location:

~/.local/state/gitback/gitback.log

Logs can be:

  • Forwarded to a log collector
  • Monitored by systemd
  • Parsed by automation tools
  • Used during troubleshooting

Recovery Behavior

GitBack automatically recreates missing runtime directories:

mirrors/
snapshots/
state/
tmp/

Recovery events are logged and backup operations continue when possible.

This allows scheduled jobs to recover from accidental directory deletion without manual intervention.

Recommendations

For most users:

  • Run discover daily
  • Run sync at least daily
  • Run snapshot after sync
  • Enable snapshot retention
  • Monitor health reports
  • Store snapshots on separate storage

Backups are only useful if they can be restored. Periodically verify snapshot integrity and recovery procedures.

Next Step

Continue with:

Clone this wiki locally