#!/bin/bash
# Automatisches Backup-Skript für Cron
# Füge zu crontab hinzu: 0 2 * * * /path/to/backup-cron.sh

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"

cd "$PROJECT_DIR"

# Backup ausführen und Log schreiben
export BACKUP_DIR="$PROJECT_DIR/backups"
"$SCRIPT_DIR/backup.sh" >> "$PROJECT_DIR/backups/backup.log" 2>&1

# Bei Fehler eine Benachrichtigung senden (optional)
if [ $? -ne 0 ]; then
    echo "Backup failed at $(date)" >> "$PROJECT_DIR/backups/backup.log"
fi
