You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
autorestic/docs/markdown/location/hooks.md

916 B

Hooks

If you want to perform some commands before and/or after a backup, you can use hooks.

They consist of a list of commands that will be executed in the same directory as the target from.

The following hooks groups are supported, none are required:

  • before
  • after
  • failure
  • success
locations:
  my-location:
    from: /data
    to: my-backend
    hooks:
      before:
        - echo "One"
        - echo "Two"
        - echo "Three"
      after:
        - echo "Byte"
      failure:
        - echo "Something went wrong"
      success:
        - echo "Well done!"

Flowchart

  1. before hook
  2. Run backup
  3. after hook
    • success hook if no errors were found
    • failure hook if at least error was encountered

If the before hook encounters errors the backup and after hooks will be skipped and only the failed hooks will run.

:ToCPrevNext