From e0a8bf8d3fd924aed3661743dec06e7938181d75 Mon Sep 17 00:00:00 2001 From: Lutchy Horace Date: Mon, 8 Jan 2024 14:36:17 -0500 Subject: [PATCH] Initial Draft --- borgbackup.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 borgbackup.sh diff --git a/borgbackup.sh b/borgbackup.sh new file mode 100755 index 0000000..93169c3 --- /dev/null +++ b/borgbackup.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +#///////////////////////////////////////////////////// +# +# +# BORG BACKUP +# +# +#///////////////////////////////////////////////////// + +# NOTE: Make sure the repository is initialize with borg init +# first before creating a backup! + +# NOTE: Make sure the expect command is installed on the system! + +# NOTE: All these variables can be placed in /etc/borgbackup.conf + +# Path to repository +# Example: user@server:/path/on/remote +# NOTE: Make sure it ends with / or face the consquences! +REPOSITORY='' + +# Passphrase for borg backup. +# NOTE: If you don't want to include the passphrase here. +# You can include it in /etc/borgbackup.conf +PASSPHRASE='' + +# Source directory to backup +# Example: /path/to/backup +SOURCE='/' + +# Exclude paths from backup. +# Example: --exclude /exclude1 --exclude /exclude2 +EXCLUDES='' + +# Run commands before backup +# Example: systemctl stop mysqld +PREHOOK="" + +# Run commands after backup +# Example: systemctl start mysqld +POSTHOOK="" + + + +# DO NOT MODIFY ANY CODE BELOW THIS LINE + +if test -f /etc/borgbackup.conf; then + source /etc/borgbackup.conf +fi + +# Define the expect script in a variable +expect_script=$(cat < "$expect_script_file" + +# Make the temporary expect script executable +chmod +x "$expect_script_file" + +# Execute the expect script +$expect_script_file + +# Clean up the temporary expect script +rm -f "$expect_script_file" + +eval $POSTHOOK \ No newline at end of file