[swss.sh] fix an issue that dependent services are not read from a file (#8943)
This is due to the SERVICE variable declared after reading a file #### Why I did it To fix an issue that dhcp_relay does not restart with swss. #### How I did it Fixed in the swss.sh script #### How to verify it sudo systemctl restart swss verify dhcp_relay restarts as well.
This commit is contained in:
parent
d632039175
commit
4ad5f2af3f
@ -1,17 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEV=$2
|
||||||
|
|
||||||
|
SERVICE="swss"
|
||||||
|
PEER="syncd"
|
||||||
|
DEBUGLOG="/tmp/swss-syncd-debug$DEV.log"
|
||||||
|
LOCKFILE="/tmp/swss-syncd-lock$DEV"
|
||||||
|
NAMESPACE_PREFIX="asic"
|
||||||
|
ETC_SONIC_PATH="/etc/sonic/"
|
||||||
|
|
||||||
DEPENDENT="radv"
|
DEPENDENT="radv"
|
||||||
MULTI_INST_DEPENDENT="teamd"
|
MULTI_INST_DEPENDENT="teamd"
|
||||||
|
|
||||||
# Update dependent list based on other packages requirements
|
|
||||||
if [[ -f /etc/sonic/${SERVICE}_dependent ]]; then
|
|
||||||
DEPENDENT="${DEPENDENT} $(cat /etc/sonic/${SERVICE}_dependent)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f /etc/sonic/${SERVICE}_multi_inst_dependent ]]; then
|
|
||||||
MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat /etc/sonic/${SERVICE}_multi_inst_dependent"
|
|
||||||
fi
|
|
||||||
|
|
||||||
. /usr/local/bin/asic_status.sh
|
. /usr/local/bin/asic_status.sh
|
||||||
|
|
||||||
function debug()
|
function debug()
|
||||||
@ -20,6 +20,18 @@ function debug()
|
|||||||
/bin/echo `date` "- $1" >> ${DEBUGLOG}
|
/bin/echo `date` "- $1" >> ${DEBUGLOG}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function read_dependent_services()
|
||||||
|
{
|
||||||
|
# Update dependent list based on other packages requirements
|
||||||
|
if [[ -f ${ETC_SONIC_PATH}/${SERVICE}_dependent ]]; then
|
||||||
|
DEPENDENT="${DEPENDENT} $(cat ${ETC_SONIC_PATH}/${SERVICE}_dependent)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent ]]; then
|
||||||
|
MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function lock_service_state_change()
|
function lock_service_state_change()
|
||||||
{
|
{
|
||||||
debug "Locking ${LOCKFILE} from ${SERVICE}$DEV service"
|
debug "Locking ${LOCKFILE} from ${SERVICE}$DEV service"
|
||||||
@ -270,13 +282,6 @@ stop() {
|
|||||||
stop_peer_and_dependent_services
|
stop_peer_and_dependent_services
|
||||||
}
|
}
|
||||||
|
|
||||||
DEV=$2
|
|
||||||
|
|
||||||
SERVICE="swss"
|
|
||||||
PEER="syncd"
|
|
||||||
DEBUGLOG="/tmp/swss-syncd-debug$DEV.log"
|
|
||||||
LOCKFILE="/tmp/swss-syncd-lock$DEV"
|
|
||||||
NAMESPACE_PREFIX="asic"
|
|
||||||
if [ "$DEV" ]; then
|
if [ "$DEV" ]; then
|
||||||
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
|
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
|
||||||
SONIC_DB_CLI="sonic-db-cli -n $NET_NS"
|
SONIC_DB_CLI="sonic-db-cli -n $NET_NS"
|
||||||
@ -285,6 +290,8 @@ else
|
|||||||
SONIC_DB_CLI="sonic-db-cli"
|
SONIC_DB_CLI="sonic-db-cli"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
read_dependent_services
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start|wait|stop)
|
start|wait|stop)
|
||||||
$1
|
$1
|
||||||
|
Loading…
Reference in New Issue
Block a user