#!/bin/bash if [ -z "$1" ]; then echo "Nutzung: $0 (docker-compose.yml|nginx.conf)" exit 1 fi DATEI="$1" TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S") BACKUP_DIR="/home/thomas/backup_images/${TIMESTAMP}_config_${DATEI}" mkdir -p "$BACKUP_DIR" if [ "$DATEI" = "docker-compose.yml" ]; then SRC="/home/thomas/docker-compose.yml" elif [ "$DATEI" = "nginx.conf" ]; then SRC="/home/thomas/container/nginx/nginx.conf" else echo "Unbekannte Datei: $DATEI" exit 1 fi cp "$SRC" "$BACKUP_DIR/" echo "Config-Backup für $DATEI gespeichert unter $BACKUP_DIR/"