Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[services] Services which start containers now use 'docker wait' instead of 'docker attach' #2661

Merged
merged 1 commit into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/build_templates/bgp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/database.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/dhcp_relay.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,20 @@ start() {
postStartAction
}

attach() {
docker attach --no-stdin {{docker_container_name}}
wait() {
docker wait {{docker_container_name}}
}

stop() {
docker stop {{docker_container_name}}
}

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
2 changes: 1 addition & 1 deletion files/build_templates/lldp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/pmon.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/radv.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/snmp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion files/build_templates/swss.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/syncd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/teamd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/telemetry.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ start() {
unlock_service_state_change
}

attach() {
wait() {
startPeerService
/usr/bin/${SERVICE}.sh attach
/usr/bin/${SERVICE}.sh wait
}

stop() {
Expand All @@ -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
8 changes: 4 additions & 4 deletions files/scripts/syncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ start() {
unlock_service_state_change
}

attach() {
/usr/bin/${SERVICE}.sh attach
wait() {
/usr/bin/${SERVICE}.sh wait
}

stop() {
Expand Down Expand Up @@ -168,11 +168,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