From 76bbd8e350dcc525f9baa2bcb42f6347b917f851 Mon Sep 17 00:00:00 2001 From: Night Owl <176560581+ShadowOwlCode@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:22:10 +0330 Subject: [PATCH] Create backup.sh --- core/scripts/hysteria2/backup.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/scripts/hysteria2/backup.sh 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