LinuxCommandLibrary

resticprofile-schedule

Schedule resticprofile backups

TLDR

Schedule default profile

$ resticprofile schedule
copy

Schedule a profile (default profile is "default")
$ resticprofile --name "[group_name]" schedule
copy

Schedule all profiles
$ resticprofile schedule --all
copy

Don't start the job after installing
$ resticprofile schedule --no-start
copy

Display status of scheduled jobs for a profile
$ resticprofile status [[-n|--name]] [profile_name]
copy

Run a scheduled job manually (used by system scheduler)
$ resticprofile run-schedule "backup@[profile_name]"
copy

SYNOPSIS

resticprofile-schedule [PROFILE_NAME]

PARAMETERS

PROFILE_NAME
    Specifies the name of the resticprofile to be executed. The command will load the configuration for this profile and perform the scheduled backup, prune, or check operations as defined within it. If omitted in some setups, a default profile might be assumed or it might iterate through all configured profiles, though explicitly naming is common practice.

DESCRIPTION

resticprofile-schedule is a helper utility within the resticprofile ecosystem, designed to automate and manage Restic backups. Unlike standalone command-line tools with extensive options, resticprofile-schedule acts as an execution engine, typically invoked by an external scheduler like cron(8) or systemd.timer(5).

Its primary function is to trigger backup, prune, and check operations based on predefined configurations within a resticprofile. When called, it reads the specified profile's settings, including paths to backup, repository details, retention policies, and pre/post-backup hooks, and then orchestrates the corresponding restic commands. This abstraction simplifies complex backup strategies, allowing users to define schedules and backup parameters in declarative YAML files, and then rely on resticprofile-schedule to execute them consistently. It ensures that backups adhere to the configured schedule and policies without requiring manual intervention.

CAVEATS

resticprofile-schedule does not manage the scheduling frequency or timing itself; it relies on external system schedulers such as cron(8) or systemd.timer(5) to invoke it at specified intervals. All backup configurations, including paths, repositories, and retention policies, are defined within the resticprofile configuration files (typically YAML files), not through command-line arguments to resticprofile-schedule.
Error handling and reporting largely depend on the output of the underlying restic commands and the surrounding scripting or scheduler configuration.

INTEGRATION WITH CRON

To schedule resticprofile-schedule using cron(8), you typically add an entry to your crontab. For example, to run a backup for 'my_profile' every day at 3:00 AM, you would add:
0 3 * * * /usr/bin/resticprofile-schedule my_profile >> /var/log/resticprofile-my_profile.log 2>&1
This ensures regular, automated execution of your defined backup profile.

INTEGRATION WITH SYSTEMD.TIMER

For more advanced scheduling and logging, resticprofile-schedule can be integrated with systemd.timer(5). This involves creating a .service unit and a corresponding .timer unit. For example, a resticprofile-my_profile.service might contain:
[Unit]
Description=Restic Backup for my_profile

[Service]
Type=oneshot
ExecStart=/usr/bin/resticprofile-schedule my_profile

And a resticprofile-my_profile.timer could be:
[Unit]
Description=Run Restic Backup for my_profile daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

This provides better process management, logging via journalctl(1), and dependency handling.

HISTORY

resticprofile-schedule is an integral part of the resticprofile project, which emerged as a solution to manage and simplify the often complex configuration and execution of Restic backups. Developed to provide a more user-friendly interface for defining backup strategies, resticprofile-schedule was designed from its inception to be invoked by system schedulers, offering a robust and automated way to maintain data integrity and availability.

SEE ALSO

restic(1), resticprofile(1), cron(8), systemd.timer(5), systemd.service(5)

Copied to clipboard