[services] Ensure swss and syncd services start before dependent services (#2634)

* [services] Ensure swss and syncd services start before dependent services

* Add 'attach' functions to scripts which get installed to /usr/local/bin so that services only reference the one script each

* Add 'After=swss.service' to syncd.service
This commit is contained in:
Joe LeVeque 2019-03-02 15:28:34 -08:00 committed by Ying Xie
parent 83c645d69f
commit c6ccb80803
4 changed files with 15 additions and 6 deletions

View File

@ -13,7 +13,8 @@ Before=ntp-config.service
[Service]
User=root
Environment=sonic_asic_platform={{ sonic_asic_platform }}
ExecStart=/usr/local/bin/swss.sh start
ExecStartPre=/usr/local/bin/swss.sh start
ExecStart=/usr/local/bin/swss.sh attach
ExecStop=/usr/local/bin/swss.sh stop
[Install]

View File

@ -13,12 +13,14 @@ After=opennsl-modules-4.9.0-8-amd64.service
{% elif sonic_asic_platform == 'nephos' %}
After=nps-modules-4.9.0-8-amd64.service
{% endif %}
After=swss.service
Before=ntp-config.service
[Service]
User=root
Environment=sonic_asic_platform={{ sonic_asic_platform }}
ExecStart=/usr/local/bin/syncd.sh start
ExecStartPre=/usr/local/bin/syncd.sh start
ExecStart=/usr/local/bin/syncd.sh attach
ExecStop=/usr/local/bin/syncd.sh stop
[Install]

View File

@ -109,6 +109,9 @@ start() {
if [[ x"$WARM_BOOT" != x"true" ]]; then
/bin/systemctl start ${PEER}
fi
}
attach() {
/usr/bin/${SERVICE}.sh attach
}
@ -134,11 +137,11 @@ stop() {
}
case "$1" in
start|stop)
start|attach|stop)
$1
;;
*)
echo "Usage: $0 {start|stop}"
echo "Usage: $0 {start|attach|stop}"
exit 1
;;
esac

View File

@ -117,6 +117,9 @@ start() {
debug "Started ${SERVICE} service..."
unlock_service_state_change
}
attach() {
/usr/bin/${SERVICE}.sh attach
}
@ -165,11 +168,11 @@ stop() {
}
case "$1" in
start|stop)
start|attach|stop)
$1
;;
*)
echo "Usage: $0 {start|stop}"
echo "Usage: $0 {start|attach|stop}"
exit 1
;;
esac