Remove dependency to restart_hysteria_service function instead use
cli.py restart-hysteria2
This commit is contained in:
@ -31,7 +31,7 @@ add_user() {
|
|||||||
'.[$username] = {password: $password, max_download_bytes: $traffic, expiration_days: $expiration_days, account_creation_date: $creation_date, blocked: false}' \
|
'.[$username] = {password: $password, max_download_bytes: $traffic, expiration_days: $expiration_days, account_creation_date: $creation_date, blocked: false}' \
|
||||||
/etc/hysteria/users/users.json > /etc/hysteria/users/users_temp.json && mv /etc/hysteria/users/users_temp.json /etc/hysteria/users/users.json
|
/etc/hysteria/users/users.json > /etc/hysteria/users/users_temp.json && mv /etc/hysteria/users/users_temp.json /etc/hysteria/users/users.json
|
||||||
|
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
|
|
||||||
echo -e "\033[0;32mUser $username added successfully.\033[0m"
|
echo -e "\033[0;32mUser $username added successfully.\033[0m"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ done
|
|||||||
|
|
||||||
if [ -f "/etc/hysteria/config.json" ]; then
|
if [ -f "/etc/hysteria/config.json" ]; then
|
||||||
jq --arg port "$port" '.listen = ":" + $port' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
jq --arg port "$port" '.listen = ":" + $port' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
echo "Port changed successfully to $port."
|
echo "Port changed successfully to $port."
|
||||||
else
|
else
|
||||||
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
||||||
|
|||||||
@ -18,7 +18,7 @@ remove_user() {
|
|||||||
jq --arg username "$username" 'del(.[$username])' /etc/hysteria/traffic_data.json > /etc/hysteria/traffic_data_temp.json && mv /etc/hysteria/traffic_data_temp.json /etc/hysteria/traffic_data.json
|
jq --arg username "$username" 'del(.[$username])' /etc/hysteria/traffic_data.json > /etc/hysteria/traffic_data_temp.json && mv /etc/hysteria/traffic_data_temp.json /etc/hysteria/traffic_data.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
echo "User $username removed successfully."
|
echo "User $username removed successfully."
|
||||||
else
|
else
|
||||||
echo -e "\033[0;31mError:\033[0m User $username not found."
|
echo -e "\033[0;31mError:\033[0m User $username not found."
|
||||||
|
|||||||
@ -11,7 +11,7 @@ bash <(curl -fsSL https://get.hy2.sh/) >/dev/null 2>&1
|
|||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "${red}Error:${NC} Failed to download or install the latest version. Restoring backup configuration."
|
echo "${red}Error:${NC} Failed to download or install the latest version. Restoring backup configuration."
|
||||||
mv /etc/hysteria/config_backup.json /etc/hysteria/config.json
|
mv /etc/hysteria/config_backup.json /etc/hysteria/config.json
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ fi
|
|||||||
|
|
||||||
rm /etc/hysteria/config.yaml
|
rm /etc/hysteria/config.yaml
|
||||||
systemctl daemon-reload >/dev/null 2>&1
|
systemctl daemon-reload >/dev/null 2>&1
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "${red}Error:${NC} Failed to restart Hysteria2 service."
|
echo "${red}Error:${NC} Failed to restart Hysteria2 service."
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@ -68,7 +68,7 @@ if [ -f "$CONFIG_FILE" ]; then
|
|||||||
echo "Invalid option. Please try again."
|
echo "Invalid option. Please try again."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
else
|
else
|
||||||
echo "${red}Error:${NC} Config file $CONFIG_FILE not found."
|
echo "${red}Error:${NC} Config file $CONFIG_FILE not found."
|
||||||
fi
|
fi
|
||||||
@ -10,7 +10,7 @@ else
|
|||||||
# Add the outbound configuration to the config.json file
|
# Add the outbound configuration to the config.json file
|
||||||
jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||||
# Restart the hysteria-server service
|
# Restart the hysteria-server service
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
echo "WARP installed and outbound added to config.json."
|
echo "WARP installed and outbound added to config.json."
|
||||||
else
|
else
|
||||||
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
||||||
|
|||||||
@ -20,7 +20,7 @@ if systemctl is-active --quiet wg-quick@wgcf.service; then
|
|||||||
' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||||
jq 'del(.outbounds[] | select(.name == "warps" and .type == "direct" and .direct.mode == 4 and .direct.bindDevice == "wgcf"))' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
jq 'del(.outbounds[] | select(.name == "warps" and .type == "direct" and .direct.mode == 4 and .direct.bindDevice == "wgcf"))' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||||
|
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||||
echo "WARP uninstalled and configurations reset to default."
|
echo "WARP uninstalled and configurations reset to default."
|
||||||
else
|
else
|
||||||
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
||||||
|
|||||||
Reference in New Issue
Block a user