Added modules
This commit is contained in:
parent
c53c931217
commit
59ec520742
646 changed files with 35182 additions and 0 deletions
31
modules/postgresql/files/validate_postgresql_connection.sh
Normal file
31
modules/postgresql/files/validate_postgresql_connection.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# usage is: validate_db_connection 2 50 psql
|
||||
|
||||
SLEEP=$1
|
||||
TRIES=$2
|
||||
PSQL=$3
|
||||
|
||||
STATE=1
|
||||
|
||||
for (( c=1; c<=$TRIES; c++ ))
|
||||
do
|
||||
echo $c
|
||||
if [ $c -gt 1 ]
|
||||
then
|
||||
echo 'sleeping'
|
||||
sleep $SLEEP
|
||||
fi
|
||||
|
||||
/bin/echo "SELECT 1" | $PSQL
|
||||
STATE=$?
|
||||
|
||||
if [ $STATE -eq 0 ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'Unable to connect to postgresql'
|
||||
|
||||
exit 1
|
Loading…
Add table
Add a link
Reference in a new issue