Merge pull request #59 from ReturnFI/dev

Add SSL certificate deletion
This commit is contained in:
Whispering Wind
2024-12-17 16:42:57 +03:30
committed by GitHub
2 changed files with 25 additions and 4 deletions

View File

@ -79,14 +79,24 @@ start_service() {
} }
stop_service() { stop_service() {
if [ -f /etc/hysteria/core/scripts/normalsub/.env ]; then
source /etc/hysteria/core/scripts/normalsub/.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 normalsub.service > /dev/null 2>&1 systemctl stop normalsub.service > /dev/null 2>&1
systemctl disable normalsub.service > /dev/null 2>&1 systemctl disable normalsub.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1 systemctl daemon-reload > /dev/null 2>&1
rm -f /etc/hysteria/core/scripts/normalsub/.env rm -f /etc/hysteria/core/scripts/normalsub/.env
echo -e "\n"
echo -e "${yellow}normalsub service stopped and disabled. .env file removed. ${NC}" echo -e "${yellow}normalsub service stopped and disabled. .env file removed.${NC}"
} }
case "$1" in case "$1" in

View File

@ -79,16 +79,27 @@ start_service() {
} }
stop_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 stop singbox.service > /dev/null 2>&1
systemctl disable singbox.service > /dev/null 2>&1 systemctl disable singbox.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1 systemctl daemon-reload > /dev/null 2>&1
rm -f /etc/hysteria/core/scripts/singbox/.env 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 case "$1" in
start) start)
if [ -z "$2" ] || [ -z "$3" ]; then if [ -z "$2" ] || [ -z "$3" ]; then