Skip to content
Rested
All guides
10 min readWritten and maintained by Rested

Automating VPS backups: when cron and restic stop being enough

Evaluate cron and restic for VPS backups, including the operational work around secrets, missed runs, retention, monitoring, and recovery.

Rested backup logs showing successful scheduled and manual runs with timestamps, snapshot IDs, sizes, and durations.
Operational confidence comes from visible run history, not from a scheduler that only reports when someone checks it.

Start with the storage and recovery boundary

Restic is a strong encrypted backup engine, but the repository is only useful when it sits outside the VPS failure domain and the recovery password survives loss of the server. Decide who owns the storage account, where recovery credentials live, and how access is regained during an incident.

A local scheduler also needs credentials, yet those secrets should not appear in process arguments, logs, or a world-readable configuration. Designing that boundary is operational work, not a one-time installation command.

    Define what a successful run means

    A usable job backs up the intended files and creates database-aware artifacts where live application state cannot be copied safely. It rejects overlap, preserves the previous recovery point when preparation fails, and reports which stage failed.

    Retention is a separate destructive operation. Apply it only after a valid new recovery point exists, monitor its result independently, and leave enough history for failures that are discovered days or weeks later.

      Cron handles time, not accountability

      Cron is reasonable for one stable host when another system checks the result. Systemd timers integrate with service status and the journal, and a timer configured as persistent can catch an activation missed while the host was down. Both schedulers still remain local to the machine they protect.

      That creates a blind spot: a deleted schedule, dead host, expired credential, or broken wrapper may produce no failed command at all. An external system must notice that the last successful recovery point is becoming stale.

        Prevent overlap and handle interruption

        A backup that runs longer than its interval can collide with the next activation or with repository maintenance. Define whether the second run waits, exits, or is skipped, and make that outcome visible. Concurrency control must cover the full workflow, including database preparation and cleanup, rather than only the final repository write.

        After a reboot or network interruption, confirm whether a new recovery point was actually committed. Do not remove repository locks merely because a job appears old; first establish that no active process still owns the work. Earlier snapshots may remain healthy even when the expected new one is absent.

          Monitor failures and test restores

          Automation needs both immediate failure reporting and stale-success detection. Keep those signals outside the VPS and make them identify the affected host, backup set, last valid recovery point, and owner.

          Restore rehearsals should use an isolated target and the same credentials an incident responder would have. Record duration and application validation, because a successful upload does not prove the service can be recovered in time.

            Common pitfalls

            Most broken cron backups come from a few recurring mistakes.

            • Secrets in scheduler configuration — use the host's restricted secret mechanism and keep values out of arguments and shared logs.
            • No retention or cleanup plan — the repository and storage bill keep growing.
            • Silent failures — a cron job with no monitoring is a backup you will discover is broken during a restore.
            • Backing up only to the same VPS — that copy shares the failure domain and is not an independent recovery path.

            Know the point where local scheduling costs more

            The threshold is not a particular server count. Local scheduling becomes expensive when nobody can answer, without logging into each host, which services are covered, how old their newest recovery points are, who owns failures, and when each restore was last rehearsed.

            That can happen on one complicated server or remain manageable across several simple ones. Review the operational load after staff changes, new databases, tighter recovery targets, or repeated alert gaps. The migration trigger should be loss of reliable evidence, not frustration with cron syntax.

              When you outgrow cron

              One server and one local scheduler can be manageable. Across several servers, the cron-and-grep approach stops scaling: ownership drifts, logs stay local, recovery passwords scatter, and nobody can quickly prove the newest recovery point for every service.

              Rested provides the missing operating layer around restic: enrolled servers, database-aware backup recipes, schedules, centralized run history, failure visibility, retention, and guided restores to storage you control. The value is the maintained system, not a shell script copied onto every host.

                Technical basis

                First-party references

                Technical claims and limitations in this guide were checked against these primary sources. Confirm version-specific behavior when designing a production recovery process.

                Related from Rested

                Common questions

                Frequently asked questions

                How do I automate restic backups with cron?

                Cron can trigger restic, but production automation also needs protected credentials, application-consistent preparation, overlap control, retention after success, external stale-run detection, and restore testing. Use a maintained system when those responsibilities exceed one clearly owned host.

                How do I keep restic credentials out of cron logs?

                Use the host's established secret-management mechanism and make sure credentials never appear in scheduler arguments, command output, or shared logs. Keep an independent recovery copy away from the VPS.

                Should I use cron or a systemd timer?

                Either can trigger a backup. A systemd timer integrates with service status and the journal, and can catch missed activations when configured as persistent. Neither replaces external stale-run monitoring or restore testing.

                What should happen when a scheduled backup is still running?

                Choose and document one overlap policy: wait, skip with an alert, or fail visibly. Make sure the lock covers preparation, repository writes, and cleanup so two jobs cannot publish or delete each other's working data.