dataset/seed/applicationservice/2022.03.08/postgresql-client/templates/postgresqlclient.service

10 lines
485 B
SYSTEMD
Raw Normal View History

2022-03-08 19:42:28 +01:00
[Unit]
Description=Waiting for postgresql server
Before=network.target
[Service]
Type=oneshot
Environment=PGPASSFILE=/usr/local/lib/secrets/postgresql.pass
ExecStart=/usr/bin/timeout 90 sh -c 'while ! 3<> /dev/tcp/%%pg_client_server_domainname/5432; do sleep 1; done; echo "POSTGRESQL STARTED"'
ExecStart=/usr/bin/timeout 90 sh -c 'while ! /usr/bin/psql -h %%pg_client_server_domainname -U %%pg_client_username %%pg_client_database -c "\l"; do sleep 1; done; echo "POSTGRESQL READY"'