From 9e23002a71780fcf96046e57c2afe32769aec88e Mon Sep 17 00:00:00 2001 From: Dct Mei Date: Sat, 11 Jul 2020 07:07:03 +0800 Subject: [PATCH] fix: Determine whether to use v2ray@ and make corresponding instruction execution 1. The modification plan has not yet been tried... 2. https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/develop/install-release.sh --- install-release.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install-release.sh b/install-release.sh index 496c4c5..6c70fd7 100644 --- a/install-release.sh +++ b/install-release.sh @@ -378,7 +378,11 @@ install_startup_service_file() { start_v2ray() { if [[ -f '/etc/systemd/system/v2ray.service' ]]; then - systemctl start v2ray + if [[ -z "$V2RAY_CUSTOMIZE" ]]; then + systemctl start v2ray + else + systemctl start "$V2RAY_CUSTOMIZE" + fi fi if [[ "$?" -ne 0 ]]; then echo 'error: Failed to start V2Ray service.' @@ -388,8 +392,11 @@ start_v2ray() { } stop_v2ray() { - if [[ -f '/etc/systemd/system/v2ray.service' ]]; then + V2RAY_CUSTOMIZE="$(systemctl list-units | grep 'v2ray@' | awk -F ' ' '{print $1}')" + if [[ -z "$V2RAY_CUSTOMIZE" ]]; then systemctl stop v2ray + else + systemctl stop "$V2RAY_CUSTOMIZE" fi if [[ "$?" -ne '0' ]]; then echo 'error: Stopping the V2Ray service failed.'