[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] [Service]
User=root User=root
Environment=sonic_asic_platform={{ sonic_asic_platform }} 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 ExecStop=/usr/local/bin/swss.sh stop
[Install] [Install]

View File

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

View File

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

View File

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