Scheduling Tasks
#Plakar includes a scheduler that can run backups as well as tasks like restoring files, synchronizing Kloset stores, and verifying backup integrity.
Backups only protect you if they run regularly. Without automation, it’s easy to forget to run a backup. The backup you didn’t run is the one you’ll wish you had when something goes wrong. The Plakar scheduler lets you define tasks that run automatically at a given interval, so your backups happen consistently on a schedule.
In this guide, we will show how to set up the scheduler to run backups every day.
Requirements
#Create a configuration for your Kloset store. This ensures the scheduler can later retrieve the store passphrase:
$ plakar store add mybackups /var/backups passphrase=mysuperpassphraseThen, create the store referencing the configuration:
$ plakar at "@mybackups" createConfiguration
#Create the configuration file scheduler.yaml for the scheduler in your current directory with the following content:
agent:
tasks:
- name: backup Plakar source code
repository: "@mybackups"
backup:
path: /Users/niluje/dev/plakar/plakar
interval: 24h
check: trueThis configuration file defines a task for the Plakar scheduler, where:
nameis the task label, displayed in the UI.repositoryrefers to the Kloset store. The syntax@mystorecorresponds to the store previously configured withplakar store add mystore.backupis the task type. In this case, we back up the Plakar source code at the given path every 24 hours.checkruns a verification after the backup is created.
Running the scheduler
#You can start the scheduler by running:
$ plakar scheduler start -tasks ./scheduler.yamlThe scheduler runs in the background. To stop it, run:
$ plakar scheduler stop