Skip to content
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
7 changes: 2 additions & 5 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ function postStartAction()
{%- if docker_container_name != "database" %}
:
{%- else %}
while true; do
if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then
break
fi
sleep 1
until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do
sleep 1;
done
{%- endif %}
{%- if docker_container_name == "snmp" %}
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/swss.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ After=nps-modules-3.16.0-4-amd64.service
[Service]
User=root
# Wait for redis server start before database clean
ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done"
ExecStartPre=/bin/bash -c 'until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do sleep 1; done'
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
Expand Down
7 changes: 2 additions & 5 deletions files/scripts/configdb-load.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env bash

# Wait until redis starts
while true; do
if [ `redis-cli ping` == "PONG" ]; then
break
fi
sleep 1
until [[ $(redis-cli ping | grep -c PONG) -gt 0 ]]; do
sleep 1;
done

# If there is a config db dump file, load it
Expand Down