From 2bb5400948ba71e0ef112b8481b64f5b603be26f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 8 Mar 2019 10:59:41 -0800 Subject: [PATCH] [services] Services which start containers now use 'docker wait' instead of 'docker attach' (#2661) --- files/build_templates/bgp.service.j2 | 2 +- files/build_templates/database.service.j2 | 2 +- files/build_templates/dhcp_relay.service.j2 | 2 +- files/build_templates/docker_image_ctl.j2 | 8 ++++---- files/build_templates/lldp.service.j2 | 2 +- files/build_templates/pmon.service.j2 | 2 +- files/build_templates/radv.service.j2 | 2 +- files/build_templates/snmp.service.j2 | 2 +- files/build_templates/swss.service.j2 | 2 +- files/build_templates/syncd.service.j2 | 2 +- files/build_templates/teamd.service.j2 | 2 +- files/build_templates/telemetry.service.j2 | 2 +- files/scripts/swss.sh | 8 ++++---- files/scripts/syncd.sh | 8 ++++---- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index bc023b7d71..7200a0e3ec 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 index b248dfc7fe..efa98b168b 100644 --- a/files/build_templates/database.service.j2 +++ b/files/build_templates/database.service.j2 @@ -6,7 +6,7 @@ After=docker.service [Service] User=root ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index b4d9ceb38f..5a462e5397 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 76f55e2234..1676e4624a 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -155,8 +155,8 @@ start() { postStartAction } -attach() { - docker attach --no-stdin {{docker_container_name}} +wait() { + docker wait {{docker_container_name}} } stop() { @@ -164,11 +164,11 @@ stop() { } case "$1" in - start|stop|attach) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop|attach}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index d294a08900..c317e18efc 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index de4e62df5e..33f3173b48 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 065f019060..8cda2fdd0a 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f344f2e805..b00c210770 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -6,5 +6,5 @@ Before=ntp-config.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 8bbdc8f329..b391f95de5 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -14,7 +14,7 @@ Before=ntp-config.service User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/swss.sh start -ExecStart=/usr/local/bin/swss.sh attach +ExecStart=/usr/local/bin/swss.sh wait ExecStop=/usr/local/bin/swss.sh stop [Install] diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 6fdbed07f8..bc0c40f7ad 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -20,7 +20,7 @@ Before=ntp-config.service User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/syncd.sh start -ExecStart=/usr/local/bin/syncd.sh attach +ExecStart=/usr/local/bin/syncd.sh wait ExecStop=/usr/local/bin/syncd.sh stop [Install] diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 5cd36c6748..792b824711 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index 132924b041..d6f70a1320 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 107a2e81b4..780051def9 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -115,9 +115,9 @@ start() { unlock_service_state_change } -attach() { +wait() { startPeerService - /usr/bin/${SERVICE}.sh attach + /usr/bin/${SERVICE}.sh wait } stop() { @@ -142,11 +142,11 @@ stop() { } case "$1" in - start|attach|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|attach|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 0d43f7840f..0aa33add16 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -135,8 +135,8 @@ start() { unlock_service_state_change } -attach() { - /usr/bin/${SERVICE}.sh attach +wait() { + /usr/bin/${SERVICE}.sh wait } stop() { @@ -184,11 +184,11 @@ stop() { } case "$1" in - start|attach|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|attach|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac