diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 164600b4a1b..7d6cff95194 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -584,12 +584,15 @@ function check_ports_present() return 1 } -function check_service_enabled() +function check_service_exists() { - if systemctl is-enabled "$1" >/dev/null 2>&1; then + systemctl list-units --full -all 2>/dev/null | grep -Fq $1 + if [[ $? -eq 0 ]]; then echo true + return else echo false + return fi } @@ -598,7 +601,7 @@ function check_service_enabled() DEPENDENT="" MULTI_INST_DEPENDENT="" -if [[ $(check_service_enabled radv) == "true" ]]; then +if [[ $(check_service_exists radv) == "true" ]]; then DEPENDENT="$DEPENDENT radv" fi @@ -619,7 +622,7 @@ check_add_bgp_dependency check_ports_present PORTS_PRESENT=$? -if [[ $PORTS_PRESENT == 0 ]] && [[ $(check_service_enabled teamd) == "true" ]]; then +if [[ $PORTS_PRESENT == 0 ]] && [[ $(check_service_exists teamd) == "true" ]]; then MULTI_INST_DEPENDENT="teamd" fi