From f77c242bc4950436911eb9d14ab982d4342eff78 Mon Sep 17 00:00:00 2001 From: Angelo Fausti Date: Thu, 12 Dec 2024 13:12:36 -0700 Subject: [PATCH] Add backup.sh script --- backup/backup.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/backup/backup.sh b/backup/backup.sh index 6be9545..d2cb894 100644 --- a/backup/backup.sh +++ b/backup/backup.sh @@ -1 +1,31 @@ -echo "backup" +#!/bin/bash + +set -e + +# Configuration +BACKUP_DIR="/backup/sasquatch-influxdb-enterprise-backup" +GCS_BUCKET="gs://your-gcs-bucket" + +# Ensure the backup directory exists +mkdir -p "$BACKUP_DIR" + +echo "Starting InfluxDB Enterprise backup..." + +influxd-ctl -bind sasquatch-influxdb-enterprise-meta.sasquatch:8091 backup -strategy incremental "$BACKUP_DIR" + +if [ $? -eq 0 ]; then + echo "Backup completed successfully at $BACKUP_DIR." +else + echo "Backup failed!" >&2 + exit 1 +fi + +echo "Uploading backup to Google Cloud Storage..." +# gsutil cp -r "$BACKUP_PATH" "$GCS_BUCKET" + +if [ $? -eq 0 ]; then + echo "Backup uploaded successfully to $GCS_BUCKET." +else + echo "Failed to upload backup to GCS!" >&2 + exit 1 +fi