-
Notifications
You must be signed in to change notification settings - Fork 14
Additional GUI integration
rugk edited this page Oct 1, 2017
·
1 revision
In your configuration file, you can overwrite the functions for GUI integration, to do different or additional things. Here are some examples. (Feel free to add you own!)
# show a scary prompt if the backup fails with additional information
guiShowBackupError() {
zenity --error --text "<b>The backup process failed.</b> See the log for more details.
<small><tt>$( tail -25 path/to/log.log )</tt></small>" \
--title "BorgBackup \"$BACKUP_NAME\"" --window-icon "$GUI_OVERWRITE_ICON" \
--name borg-cron-helper --class borg-cron-helper 2> /dev/null
}
# Interactively ask for retrying the backup.
guiTryAgain() {
zenity --question --text "<b>The backup failed.</b> ($i. try) Do you want to try it again?" \
--height=10 --title "BorgBackup \"$BACKUP_NAME\"" --window-icon "$GUI_OVERWRITE_ICON" \
--name borg-cron-helper --class borg-cron-helper 2> /dev/null
}
RETRY_NUM
is a maxium number fo retries, then.
Of course, also a CLI version is of the retry prompt is possible:
# ask on the shell whether to retry the backup
guiTryAgain() {
read -rp "The backup failed. ($i. try) Do you want to try it again? [yN]: " retry
if [ "$retry" = "Y" ] || [ "$retry" = "y" ]; then
return 0 # (true)
fi
return 1 # (false)
}