👌 IMPROVE: Restic backup

This commit is contained in:
Austin Ginder 2025-06-29 11:15:07 -04:00
parent db8027bd0b
commit 66b493ae64

View file

@ -45,7 +45,6 @@ function vault_create() {
local sql_file_path="${wp_root_dir}/${db_filename_base}.sql"

echo " - Generating temporary database dump: $(basename "$sql_file_path")"
# Add flags to handle large tables and prevent timeouts, mirroring the db_backup command.
if ! "$WP_CLI_CMD" db export "$sql_file_path" --add-drop-table --single-transaction --quick --max_allowed_packet=512M > /dev/null; then
echo "❌ Error: Database export failed."
rm -f "$sql_file_path"
@ -63,7 +62,16 @@ function vault_create() {
}

echo " - Backing up current directory (.), which now includes the SQL database dump..."
if ! "$RESTIC_CMD" backup --verbose "."; then
if ! "$RESTIC_CMD" backup --verbose "." \
--exclude '**.DS_Store' \
--exclude '*timthumb.txt' \
--exclude 'debug.log' \
--exclude 'error_log' \
--exclude 'phperror_log' \
--exclude 'wp-content/updraft' \
--exclude 'wp-content/cache' \
--exclude 'wp-content/uploads_from_s3' \
--exclude 'wp-snapshots'; then
echo "❌ Error: Restic backup command failed." >&2
rm -f "$sql_file_path"
cd "$original_dir"