Skip to content

Commit 1095b85

Browse files
committed
Add --daemon for cgimap
1 parent a7c9418 commit 1095b85

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

images/cgimap/liveness.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
pgrep -f openstreetmap-cgimap > /dev/null
3+
cgimap_status=$?
4+
5+
# Check PostgreSQL connection
6+
PGPASSWORD="$POSTGRES_PASSWORD" psql -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 1;" > /dev/null 2>&1
7+
postgres_status=$?
8+
9+
# Exit code logic
10+
if [ $cgimap_status -eq 0 ] && [ $postgres_status -eq 0 ]; then
11+
echo "cgimap and PostgreSQL are healthy"
12+
exit 0
13+
else
14+
[ $cgimap_status -ne 0 ] && echo "cgimap not running" >&2
15+
[ $postgres_status -ne 0 ] && echo "cannot connect to PostgreSQL" >&2
16+
exit 1
17+
fi

0 commit comments

Comments
 (0)