Using resticprofile

Here are a few examples how to run resticprofile (using the main example configuration file)

See all snapshots of your default profile:

resticprofile

See all available profiles in your configuration file (and the restic commands where some flags are defined):

resticprofile profiles

Profiles available (name, sections, description):
  root:           (backup, copy, forget, retention)
  self:           (backup, check, copy, forget, retention)
  src:            (backup, copy, retention, snapshots)

Groups available (name, profiles, description):
  full-backup:  [root, src]

Backup root & src profiles (using full-backup group shown earlier)

resticprofile --name "full-backup" backup

or using the syntax introduced in v0.17.0:

resticprofile full-backup.backup

Assuming the stdin profile from the configuration file shown before, the command to send a mysqldump to the backup is as simple as:

mysqldump --all-databases --order-by-primary | resticprofile --name stdin backup

or using the syntax introduced in v0.17.0:

mysqldump --all-databases --order-by-primary | resticprofile stdin.backup

Mount the default profile (default) in /mnt/restic:

resticprofile mount /mnt/restic

Display quick help

resticprofile --help

A command is either a restic command or a resticprofile own command.

Command line reference

There are not many options on the command line, most of the options are in the configuration file.

  • [-h | –help]: Display quick help
  • [-c | –config] configuration_file: Specify a configuration file other than the default (“profiles”)
  • [-f | –format] configuration_format: Specify the configuration file format: toml, yaml, json or hcl
  • [-n | –name] profile_name: Profile section to use from the configuration file. You can also use [profile_name].[command] syntax instead, this will only work if -n is not set. Using -n [profile_name] [command] or [profile_name].[command] both select profile and command and are technically equivalent.
  • [–dry-run]: Doesn’t run the restic commands but display the command lines instead
  • [-q | –quiet]: Force resticprofile and restic to be quiet (override any configuration from the profile)
  • [-v | –verbose]: Force resticprofile and restic to be verbose (override any configuration from the profile)
  • [–trace]: Display even more debugging information
  • [–no-ansi]: Disable console colouring (to save output into a log file)
  • [–stderr]: Send console output from resticprofile to stderr (is enabled for commands cat and dump)
  • [–no-lock]: Disable resticprofile locks, neither create nor fail on a lock. restic locks are unaffected by this option.
  • [–theme]: Can be light, dark or none. The colours will adjust to a light or dark terminal (none to disable colouring)
  • [–lock-wait] duration: Retry to acquire resticprofile and restic locks for up to the specified amount of time before failing on a lock failure.
  • [-l | –log] file path or url: To write the logs to a file or a syslog server instead of displaying on the console. The format of the syslog server url is syslog-tcp://192.168.0.1:514, syslog://udp-server:514 or syslog:. For custom log forwarding, the prefix temp: can be used (e.g. temp:/t/msg.log) to create unique log output that can be fed into a command or http hook by referencing it with "{{ tempFile "msg.log" }}" in the configuration file.
  • [–command-output]: Sets how to redirect command output when a log target is specified. Can be auto, log, console or all.
  • [-w | –wait]: Wait at the very end of the execution for the user to press enter. This is only useful in Windows when resticprofile is started from explorer and the console window closes automatically at the end.
  • [–ignore-on-battery]: Don’t start the profile when the computer is running on battery. You can specify a value to ignore only when the % charge left is less or equal than the value.
  • [resticprofile OR restic command]: Like snapshots, backup, check, prune, forget, mount, etc.
  • [additional flags]: Any additional flags to pass to the restic command line

Environment variables

Most flags for resticprofile can be set using environment variables. If both are specified, command line flags take the precedence.

FlagEnvironment variableBuilt-In default
--quietRESTICPROFILE_QUIETfalse
--verboseRESTICPROFILE_VERBOSEfalse
--traceRESTICPROFILE_TRACEfalse
--configRESTICPROFILE_CONFIG"profiles"
--formatRESTICPROFILE_FORMAT""
--nameRESTICPROFILE_NAME"default"
--logRESTICPROFILE_LOG""
--command-outputRESTICPROFILE_COMMAND_OUTPUT"auto"
--dry-runRESTICPROFILE_DRY_RUNfalse
--no-lockRESTICPROFILE_NO_LOCKfalse
--lock-waitRESTICPROFILE_LOCK_WAIT0
--stderrRESTICPROFILE_STDERRfalse
--no-ansiRESTICPROFILE_NO_ANSIfalse
--themeRESTICPROFILE_THEME"light"
--no-priorityRESTICPROFILE_NO_PRIORITYfalse
--waitRESTICPROFILE_WAITfalse
--ignore-on-batteryRESTICPROFILE_IGNORE_ON_BATTERY0

Other environment variables

Environment VariableDefaultPurpose
RESTICPROFILE_PWSH_NO_AUTOENVemptyDisables powershell script pre-processing that converts unset $VAR into $Env:VAR

Environment variables set by resticprofile

Environment VariableExampleWhen
RESTICPROFILE_SCHEDULE_IDprofiles.yaml:backup@profileSet when running scheduled commands