From b88e4445fb308ac3bab3d442a78d0b31011f5900 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:35:09 +0330 Subject: [PATCH] Fix certificate --- core/scripts/singbox/singbox_shell.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index 7db47c5..337fe22 100644 --- a/core/scripts/singbox/singbox_shell.sh +++ b/core/scripts/singbox/singbox_shell.sh @@ -79,16 +79,27 @@ start_service() { } stop_service() { + if [ -f /etc/hysteria/core/scripts/singbox/.env ]; then + source /etc/hysteria/core/scripts/singbox/.env + fi + + if [ -n "$HYSTERIA_DOMAIN" ]; then + echo -e "${yellow}Deleting SSL certificate for domain: $HYSTERIA_DOMAIN...${NC}" + sudo certbot delete --cert-name "$HYSTERIA_DOMAIN" --non-interactive > /dev/null 2>&1 + else + echo -e "${red}HYSTERIA_DOMAIN not found in .env. Skipping certificate deletion.${NC}" + fi + systemctl stop singbox.service > /dev/null 2>&1 systemctl disable singbox.service > /dev/null 2>&1 systemctl daemon-reload > /dev/null 2>&1 rm -f /etc/hysteria/core/scripts/singbox/.env - echo -e "\n" - echo -e "${yellow}Singbox service stopped and disabled. .env file removed. ${NC}" + echo -e "${yellow}Singbox service stopped and disabled. .env file removed.${NC}" } + case "$1" in start) if [ -z "$2" ] || [ -z "$3" ]; then