Initial commit.

This commit is contained in:
stephb9959
2022-03-23 20:52:41 -07:00
parent d5c610aae2
commit 9e09e9f3fc
5 changed files with 382 additions and 0 deletions

26
wait-for-postgres.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
# wait-for-postgres.sh
set -e
host="$1"
shift
export PGUSER=$(grep 'storage.type.postgresql.username' $OWANALYTICS_CONFIG/owprov.properties | awk -F '= ' '{print $2}')
export PGPASSWORD=$(grep 'storage.type.postgresql.password' $OWANALYTICS_CONFIG/owprov.properties | awk -F '= ' '{print $2}')
until psql -h "$host" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - executing command"
if [ "$1" = '/openwifi/owanalytics' -a "$(id -u)" = '0' ]; then
if [ "$RUN_CHOWN" = 'true' ]; then
chown -R "$OWANALYTICS_USER": "$OWANALYTICS_ROOT" "$OWANALYTICS_CONFIG"
fi
exec su-exec "$OWANALYTICS_USER" "$@"
fi
exec "$@"