@ -31,6 +31,7 @@ class Command(Enum):
|
||||
TRAFFIC_STATUS = 'traffic.py' # won't be call directly (it's a python module)
|
||||
LIST_USERS = os.path.join(SCRIPT_DIR, 'hysteria2', 'list_users.sh')
|
||||
SERVER_INFO = os.path.join(SCRIPT_DIR, 'hysteria2', 'server_info.sh')
|
||||
BACKUP_HYSTERIA = os.path.join(SCRIPT_DIR, 'hysteria2', 'backup.sh')
|
||||
INSTALL_TELEGRAMBOT = os.path.join(SCRIPT_DIR, 'telegrambot', 'runbot.sh')
|
||||
INSTALL_SINGBOX = os.path.join(SCRIPT_DIR, 'singbox', 'singbox_shell.sh')
|
||||
INSTALL_TCP_BRUTAL = os.path.join(SCRIPT_DIR, 'tcp-brutal', 'install.sh')
|
||||
@ -224,6 +225,14 @@ def server_info():
|
||||
output = run_cmd(['bash', Command.SERVER_INFO.value])
|
||||
if output:
|
||||
print(output)
|
||||
|
||||
@cli.command('backup-hysteria')
|
||||
def backup_hysteria():
|
||||
try:
|
||||
run_cmd(['bash', Command.BACKUP_HYSTERIA.value])
|
||||
except subprocess.CalledProcessError as e:
|
||||
click.echo(f"Backup failed: {e.output.decode()}", err=True)
|
||||
|
||||
# endregion
|
||||
|
||||
# region advanced menu
|
||||
|
||||
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
|
||||
@ -10,7 +10,7 @@ if ! command -v jq &> /dev/null || ! command -v git &> /dev/null || ! command -v
|
||||
echo "${yellow}Necessary packages are not installed. Please wait while they are being installed..."
|
||||
sleep 3
|
||||
echo
|
||||
apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git bc -y
|
||||
apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git bc zip -y
|
||||
fi
|
||||
|
||||
git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
||||
|
||||
Reference in New Issue
Block a user