projects
/
mirror
/
dsa-puppet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
move rsync service/socket setup into a dsa_systemd::socket_service
[mirror/dsa-puppet.git]
/
3rdparty
/
modules
/
postgresql
/
files
/
validate_postgresql_connection.sh
1
#!/bin/sh
2
3
# usage is: validate_db_connection 2 50 psql
4
5
SLEEP=$1
6
TRIES=$2
7
PSQL=$3
8
9
STATE=1
10
11
c=1
12
13
while [ $c -le $TRIES ]
14
do
15
echo $c
16
if [ $c -gt 1 ]
17
then
18
echo 'sleeping'
19
sleep $SLEEP
20
fi
21
22
/bin/echo "SELECT 1" | $PSQL
23
STATE=$?
24
25
if [ $STATE -eq 0 ]
26
then
27
exit 0
28
fi
29
c=$((c+1))
30
done
31
32
echo 'Unable to connect to postgresql'
33
34
exit 1