Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9312044
validate_postgresql_connection.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
357 B
Subscribers
None
validate_postgresql_connection.sh
View Options
#!/bin/sh
# usage is: validate_db_connection 2 50 psql
SLEEP
=
$1
TRIES
=
$2
PSQL
=
$3
STATE
=
1
c
=
1
while
[
$c
-le
$TRIES
]
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
c
=
$((
c+1
))
done
echo
'Unable to connect to postgresql'
exit
1
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Thu, Jul 3, 10:40 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3300413
Attached To
rSPPG PostgreSQL puppet module
Event Timeline
Log In to Comment