Files
FOSSBilling/puphpet/puppet/modules/postgresql/files/validate_postgresql_connection.sh
T
Vaidas Lungis 88512e863b add vagrant puphpet configuration
OS - Ubuntu 12.04
PHP - 5.4 with cli intl mcrypt curl gd imagick mbstring MySQL
IP - 10.20.30.12
target folder - /var/www/boxbilling
servername - boxbilling.test
XDEBUG
2014-12-11 12:42:50 +02:00

32 lines
355 B
Bash

#!/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