From e70cf9e5ebe8077eb9aea7ac01c828ebe0126712 Mon Sep 17 00:00:00 2001 From: LR-Coin <57722364+LR-Coin@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:19:13 +0100 Subject: [PATCH] add env and config backup script Adds a script to back up .env and Compose files into a timestamped directory, helping protect configuration in case of accidental changes. --- bin/backup_env.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bin/backup_env.sh diff --git a/bin/backup_env.sh b/bin/backup_env.sh new file mode 100644 index 00000000..5babee7e --- /dev/null +++ b/bin/backup_env.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Creates a timestamped backup of .env and config files. +# Backups are stored under ./backups with the current date and time. + +TIMESTAMP=$(date +"%Y%m%d%H%M%S") +BACKUP_DIR="./backups/${TIMESTAMP}" +mkdir -p "${BACKUP_DIR}" + +for file in .env docker-compose.yml docker-compose.override*.yml; do + if [ -f "$file" ]; then + cp "$file" "${BACKUP_DIR}/" + echo "Backed up $file → ${BACKUP_DIR}/" + fi +done + +echo "Backup complete. Files are saved in ${BACKUP_DIR}"