Key Syntax
On the commandline, crestic commands follow the syntax
crestic preset command [--options, ...]
Where preset is a preset key in the config file, and command is the restic command.
Crestic config keys follow the convention
[preset]
[preset.command]
where preset and command are the preset and command names from above. For example
[home]
...
[home.backup]
...
are read for crestic home backup calls.
Special Presets
There exist a few special config keys:
[global]is a special pseudo preset which is always read before any actual preset value.[global.command]is a special pseudo command which is always read before any actual preset command. These two keys can be used to set global values, valid for any preset, i.e. a password-file[global.environ],[preset.environ],[global.command.environ]and[preset.command.environ]are special pseudo commands which are used to set environment variables for theresticcommand. They are usually used to set cloud provider credentials.
Config keys are always read in the following order, of ascending importance. Later values override earlier ones:
[global][global.command][preset][preset.command]- options from the commandline
Mixing Presets
crestic allows multiple presets per config file. For example you can define a config file
[global]
password-file: ~/.config/restic/password
repo: sftp:your_server:my_computer.restic
[global.backup]
exclude-file: ~/.config/restic/excludes
[home.backup]
_arguments: ~
[work.backup]
_arguments: ~/work
which can be used as crestic home backup and crestic work backup. Both commands back up using the same password-file, repo, and exclude-file, but different arguments (directories that are being backed up.)
Split Presets
crestic allows for so-called split presets. These split presets are in the format of prefix@suffix and are usually used to separate local location values from remote repo locations, i.e. location@repo.
Using this technique you can back up several locations on your machine to several remote repositories, i.e. the locations home and work to the repos disk and cloud
crestic home@disk backup
crestic home@cloud backup
crestic work@disk backup
crestic work@cloud backup
To use these split presets, simply define location keys with an @ suffix and repo keys with an @ prefix
[home@.backup]
_arguments: ~
[work@.backup]
_arguments: ~/work
[@disk]
repo: /Volumes/Backup
[@cloud]
repo: b2:bucketname:my_computer.restic
[@cloud.environ]
B2_ACCOUNT_ID: <MY_APPLICATION_KEY_ID>
B2_ACCOUNT_KEY: <MY_APPLICATION_KEY>
Split config keys are always read in the following order, of ascending importance. Later values override earlier ones:
[global][global.command][@repo][@repo.command][location@][location@.command][location@repo][location@repo.command]- options from the commandline