[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" %}
|
||||
:
|
||||
{%- 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" %}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user