Create backup.sh
This commit is contained in:
23
core/scripts/hysteria2/backup.sh
Normal file
23
core/scripts/hysteria2/backup.sh
Normal file
@ -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
|
||||
Reference in New Issue
Block a user