You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tl;dr logs are captured for command hooks today but these are verbose and intended to capture "everything" for debugging. Command hooks should be able to provide concise summaries (viewable at a glance in the UI) of their result.
Proposal
command hooks should be exec'd with an extra open file descriptor (fd 3) where a command hook can write status information. A command hook can set it's exit status by exiting with 0 (success) or non-zero (failure).
fd3 will be a unix pipe consumed by backrest and buffered in memory. The message written here will be stored in the operation representing the hook and will be presented in the UI.
A hypothetical usage example:
#!/bin/bash
if ping -q -c 1 -W 1 google.com >/dev/null; then
echo "Internet connection is up" &>3
exit 0
else
echo "Internet connection is down" &>3
exit 1
fi
will skip (or not skip) a backup based on the result of a ping to google.com and writes a descriptive status message to fd3 which will be viewable in the UI for a user to easily understand the result.
or more simply
echo "FOO" &>3
writes text to file descriptor 3 in a shell script.
Tl;dr logs are captured for command hooks today but these are verbose and intended to capture "everything" for debugging. Command hooks should be able to provide concise summaries (viewable at a glance in the UI) of their result.
Proposal
command hooks should be exec'd with an extra open file descriptor (fd 3) where a command hook can write status information. A command hook can set it's exit status by exiting with 0 (success) or non-zero (failure).
fd3 will be a unix pipe consumed by backrest and buffered in memory. The message written here will be stored in the operation representing the hook and will be presented in the UI.
A hypothetical usage example:
will skip (or not skip) a backup based on the result of a ping to
google.com
and writes a descriptive status message to fd3 which will be viewable in the UI for a user to easily understand the result.or more simply
writes text to file descriptor 3 in a shell script.
The ultimate goal is for Backrest to facilitate a basic scripting model (built on unix principles) for users to customize backup scheduling, I'll try to collect a cookbook of worked-out scripts at https://garethgeorge.github.io/backrest/cookbooks/command-hook-examples .
Note: ExtraFiles is a Unix only feature, this will not be supported on Windows
The text was updated successfully, but these errors were encountered: