diff --git a/core/scripts/hysteria2/backup.sh b/core/scripts/hysteria2/backup.sh new file mode 100644 index 0000000..ec3c473 --- /dev/null +++ b/core/scripts/hysteria2/backup.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +BACKUP_DIR="/opt/hysbackup" +BACKUP_FILE="$BACKUP_DIR/hysteria_backup_$(date +%Y%m%d_%H%M%S).zip" + +if [ ! -d "$BACKUP_DIR" ]; then + mkdir -p "$BACKUP_DIR" +fi + +FILES_TO_BACKUP=( + "/etc/hysteria/ca.key" + "/etc/hysteria/ca.crt" + "/etc/hysteria/users.json" + "/etc/hysteria/config.json" +) + +zip -j "$BACKUP_FILE" "${FILES_TO_BACKUP[@]}" >/dev/null 2>&1 + +if [ $? -eq 0 ]; then + echo "Backup successfully created" +else + echo "Backup failed!" +fi