[scripts]: Fix issues with checking status of the DB. Use one approach everywhere. (#1323)
This commit is contained in:
parent
163a0e2165
commit
8cfa223ef9
@ -10,11 +10,8 @@ function postStartAction()
|
|||||||
{%- if docker_container_name != "database" %}
|
{%- if docker_container_name != "database" %}
|
||||||
:
|
:
|
||||||
{%- else %}
|
{%- else %}
|
||||||
while true; do
|
until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do
|
||||||
if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then
|
sleep 1;
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
done
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if docker_container_name == "snmp" %}
|
{%- if docker_container_name == "snmp" %}
|
||||||
|
@ -17,7 +17,7 @@ After=nps-modules-3.16.0-4-amd64.service
|
|||||||
[Service]
|
[Service]
|
||||||
User=root
|
User=root
|
||||||
# Wait for redis server start before database clean
|
# 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 0 FLUSHDB
|
||||||
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
|
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
|
||||||
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
|
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Wait until redis starts
|
# Wait until redis starts
|
||||||
while true; do
|
until [[ $(redis-cli ping | grep -c PONG) -gt 0 ]]; do
|
||||||
if [ `redis-cli ping` == "PONG" ]; then
|
sleep 1;
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there is a config db dump file, load it
|
# If there is a config db dump file, load it
|
||||||
|
Loading…
Reference in New Issue
Block a user