Refactor services name
This commit is contained in:
@ -26,7 +26,7 @@ EOL
|
||||
}
|
||||
|
||||
create_service_file() {
|
||||
cat <<EOL > /etc/systemd/system/normalsub.service
|
||||
cat <<EOL > /etc/systemd/system/hysteria-normal-sub.service
|
||||
[Unit]
|
||||
Description=normalsub Python Service
|
||||
After=network.target
|
||||
@ -48,8 +48,8 @@ start_service() {
|
||||
local domain=$1
|
||||
local port=$2
|
||||
|
||||
if systemctl is-active --quiet normalsub.service; then
|
||||
echo "The normalsub.service is already running."
|
||||
if systemctl is-active --quiet hysteria-normal-sub.service; then
|
||||
echo "The hysteria-normal-sub.service is already running."
|
||||
return
|
||||
fi
|
||||
|
||||
@ -67,11 +67,11 @@ start_service() {
|
||||
chown -R hysteria:hysteria "/etc/letsencrypt/live/$domain"
|
||||
chown -R hysteria:hysteria /etc/hysteria/core/scripts/normalsub
|
||||
systemctl daemon-reload
|
||||
systemctl enable normalsub.service > /dev/null 2>&1
|
||||
systemctl start normalsub.service > /dev/null 2>&1
|
||||
systemctl enable hysteria-normal-sub.service > /dev/null 2>&1
|
||||
systemctl start hysteria-normal-sub.service > /dev/null 2>&1
|
||||
systemctl daemon-reload > /dev/null 2>&1
|
||||
|
||||
if systemctl is-active --quiet normalsub.service; then
|
||||
if systemctl is-active --quiet hysteria-normal-sub.service; then
|
||||
echo -e "${green}normalsub service setup completed. The service is now running on port $port. ${NC}"
|
||||
else
|
||||
echo -e "${red}normalsub setup completed. The service failed to start. ${NC}"
|
||||
@ -90,8 +90,8 @@ stop_service() {
|
||||
echo -e "${red}HYSTERIA_DOMAIN not found in .env. Skipping certificate deletion.${NC}"
|
||||
fi
|
||||
|
||||
systemctl stop normalsub.service > /dev/null 2>&1
|
||||
systemctl disable normalsub.service > /dev/null 2>&1
|
||||
systemctl stop hysteria-normal-sub.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-normal-sub.service > /dev/null 2>&1
|
||||
systemctl daemon-reload > /dev/null 2>&1
|
||||
|
||||
rm -f /etc/hysteria/core/scripts/normalsub/.env
|
||||
|
||||
Reference in New Issue
Block a user