Refactor services name
This commit is contained in:
@ -122,13 +122,13 @@ show_uri() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$generate_singbox" = true ] && systemctl is-active --quiet singbox.service; then
|
||||
if [ "$generate_singbox" = true ] && systemctl is-active --quiet hysteria-singbox.service; then
|
||||
read -r domain port < <(get_singbox_domain_and_port)
|
||||
if [ -n "$domain" ] && [ -n "$port" ]; then
|
||||
echo -e "\nSingbox Sublink:\nhttps://$domain:$port/sub/singbox/$username/$ip_version#$username\n"
|
||||
fi
|
||||
fi
|
||||
if [ "$generate_normalsub" = true ] && systemctl is-active --quiet normalsub.service; then
|
||||
if [ "$generate_normalsub" = true ] && systemctl is-active --quiet hysteria-normal-sub.service; then
|
||||
read -r domain port < <(get_normalsub_domain_and_port)
|
||||
if [ -n "$domain" ] && [ -n "$port" ]; then
|
||||
echo -e "\nNormal-SUB Sublink:\nhttps://$domain:$port/sub/normal/$username#Hysteria2\n"
|
||||
|
||||
@ -32,12 +32,12 @@ echo "Removing alias 'hys2' from .bashrc..."
|
||||
sed -i '/alias hys2=.*\/etc\/hysteria\/menu.sh/d' ~/.bashrc
|
||||
|
||||
echo "Stop/Disabling Hysteria TelegramBOT Service..."
|
||||
systemctl stop hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl stop hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
|
||||
echo "Stop/Disabling Singbox SubLink Service..."
|
||||
systemctl stop singbox.service > /dev/null 2>&1
|
||||
systemctl disable singbox.service > /dev/null 2>&1
|
||||
systemctl stop hysteria-singbox.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-singbox.service > /dev/null 2>&1
|
||||
|
||||
|
||||
echo "Hysteria2 uninstalled!"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
declare -a services=(
|
||||
"hysteria-server.service"
|
||||
"webpanel.service"
|
||||
"hysteria-bot.service"
|
||||
"normalsub.service"
|
||||
"singbox.service"
|
||||
"hysteria-telegram-bot.service"
|
||||
"hysteria-normal-sub.service"
|
||||
"hysteria-singbox.service"
|
||||
"wg-quick@wgcf.service"
|
||||
)
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ EOL
|
||||
}
|
||||
|
||||
create_service_file() {
|
||||
cat <<EOL > /etc/systemd/system/singbox.service
|
||||
cat <<EOL > /etc/systemd/system/hysteria-singbox.service
|
||||
[Unit]
|
||||
Description=Singbox Python Service
|
||||
After=network.target
|
||||
@ -48,8 +48,8 @@ start_service() {
|
||||
local domain=$1
|
||||
local port=$2
|
||||
|
||||
if systemctl is-active --quiet singbox.service; then
|
||||
echo "The singbox.service is already running."
|
||||
if systemctl is-active --quiet hysteria-singbox.service; then
|
||||
echo "The hysteria-singbox.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/singbox
|
||||
systemctl daemon-reload
|
||||
systemctl enable singbox.service > /dev/null 2>&1
|
||||
systemctl start singbox.service > /dev/null 2>&1
|
||||
systemctl enable hysteria-singbox.service > /dev/null 2>&1
|
||||
systemctl start hysteria-singbox.service > /dev/null 2>&1
|
||||
systemctl daemon-reload > /dev/null 2>&1
|
||||
|
||||
if systemctl is-active --quiet singbox.service; then
|
||||
if systemctl is-active --quiet hysteria-singbox.service; then
|
||||
echo -e "${green}Singbox service setup completed. The service is now running on port $port. ${NC}"
|
||||
else
|
||||
echo -e "${red}Singbox 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 singbox.service > /dev/null 2>&1
|
||||
systemctl disable singbox.service > /dev/null 2>&1
|
||||
systemctl stop hysteria-singbox.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-singbox.service > /dev/null 2>&1
|
||||
systemctl daemon-reload > /dev/null 2>&1
|
||||
|
||||
rm -f /etc/hysteria/core/scripts/singbox/.env
|
||||
|
||||
@ -13,7 +13,7 @@ EOL
|
||||
}
|
||||
|
||||
create_service_file() {
|
||||
cat <<EOL > /etc/systemd/system/hysteria-bot.service
|
||||
cat <<EOL > /etc/systemd/system/hysteria-telegram-bot.service
|
||||
[Unit]
|
||||
Description=Hysteria Telegram Bot
|
||||
After=network.target
|
||||
@ -32,8 +32,8 @@ start_service() {
|
||||
local api_token=$1
|
||||
local admin_user_ids=$2
|
||||
|
||||
if systemctl is-active --quiet hysteria-bot.service; then
|
||||
echo "The hysteria-bot.service is already running."
|
||||
if systemctl is-active --quiet hysteria-telegram-bot.service; then
|
||||
echo "The hysteria-telegram-bot.service is already running."
|
||||
return
|
||||
fi
|
||||
|
||||
@ -41,10 +41,10 @@ start_service() {
|
||||
create_service_file
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl start hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl enable hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
systemctl start hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
|
||||
if systemctl is-active --quiet hysteria-bot.service; then
|
||||
if systemctl is-active --quiet hysteria-telegram-bot.service; then
|
||||
echo -e "${green}Hysteria bot setup completed. The service is now running. ${NC}"
|
||||
echo -e "\n\n"
|
||||
else
|
||||
@ -53,8 +53,8 @@ start_service() {
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
systemctl stop hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl stop hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-telegram-bot.service > /dev/null 2>&1
|
||||
|
||||
rm -f /etc/hysteria/core/scripts/telegrambot/.env
|
||||
echo -e "\n"
|
||||
|
||||
@ -97,7 +97,7 @@ EOL
|
||||
|
||||
|
||||
create_webpanel_service_file() {
|
||||
cat <<EOL > /etc/systemd/system/webpanel.service
|
||||
cat <<EOL > /etc/systemd/system/hysteria-webpanel.service
|
||||
[Unit]
|
||||
Description=Hysteria2 Web Panel
|
||||
After=network.target
|
||||
@ -125,7 +125,7 @@ start_service() {
|
||||
|
||||
# MAYBE I WANT TO CHANGE CONFIGS WITHOUT RESTARTING THE SERVICE MYSELF
|
||||
# # Check if the services are already active
|
||||
# if systemctl is-active --quiet webpanel.service && systemctl is-active --quiet caddy.service; then
|
||||
# if systemctl is-active --quiet hysteria-webpanel.service && systemctl is-active --quiet caddy.service; then
|
||||
# echo -e "${green}Hysteria web panel is already running with Caddy.${NC}"
|
||||
# source /etc/hysteria/core/scripts/webpanel/.env
|
||||
# echo -e "${yellow}The web panel is accessible at: http://$domain:$port/$ROOT_PATH${NC}"
|
||||
@ -151,11 +151,11 @@ start_service() {
|
||||
|
||||
# Reload systemd and enable webpanel service
|
||||
systemctl daemon-reload
|
||||
systemctl enable webpanel.service > /dev/null 2>&1
|
||||
systemctl start webpanel.service > /dev/null 2>&1
|
||||
systemctl enable hysteria-webpanel.service > /dev/null 2>&1
|
||||
systemctl start hysteria-webpanel.service > /dev/null 2>&1
|
||||
|
||||
# Check if the web panel is running
|
||||
if systemctl is-active --quiet webpanel.service; then
|
||||
if systemctl is-active --quiet hysteria-webpanel.service; then
|
||||
echo -e "${green}Hysteria web panel setup completed. The web panel is running locally on: http://127.0.0.1:8080/${NC}"
|
||||
else
|
||||
echo -e "${red}Error: Hysteria web panel service failed to start.${NC}"
|
||||
@ -177,7 +177,7 @@ start_service() {
|
||||
fi
|
||||
|
||||
# Check if the web panel is still running after Caddy restart
|
||||
if systemctl is-active --quiet webpanel.service; then
|
||||
if systemctl is-active --quiet hysteria-webpanel.service; then
|
||||
source /etc/hysteria/core/scripts/webpanel/.env
|
||||
local webpanel_url="http://$domain:$port/$ROOT_PATH/"
|
||||
echo -e "${green}Hysteria web panel is now running. The service is accessible on: $webpanel_url ${NC}"
|
||||
@ -204,8 +204,8 @@ stop_service() {
|
||||
echo "Caddy stopped."
|
||||
|
||||
echo "Stopping Hysteria web panel..."
|
||||
systemctl disable webpanel.service
|
||||
systemctl stop webpanel.service
|
||||
systemctl disable hysteria-webpanel.service
|
||||
systemctl stop hysteria-webpanel.service
|
||||
echo "Hysteria web panel stopped."
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user