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}' \
|
||||
/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"
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ done
|
||||
|
||||
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
|
||||
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."
|
||||
else
|
||||
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
|
||||
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."
|
||||
else
|
||||
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
|
||||
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
|
||||
restart_hysteria_service >/dev/null 2>&1
|
||||
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -31,7 +31,7 @@ fi
|
||||
|
||||
rm /etc/hysteria/config.yaml
|
||||
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
|
||||
echo "${red}Error:${NC} Failed to restart Hysteria2 service."
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user