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

14 lines
953 B
Desktop File

[Unit]
Description=Waiting for postgresql server
After=network-online.target
Before=risotto.target
[Service]
Type=oneshot
{% if general.postgresql.pg_client_key_owner != 'root' %}
User={{ general.postgresql.pg_client_key_owner }}
{% endif %}
EnvironmentFile=/usr/local/lib/secrets/postgresql.pass2
ExecStart=/usr/bin/timeout 300 bash -c 'while ! 3<> /dev/tcp/{{ general.postgresql.pg_client_server_domainname }}/5432; do sleep 1; done; echo "POSTGRESQL STARTED"'
ExecStart=/usr/bin/timeout 90 bash -c 'while ! {% if True -%}{% endif -%}
/usr/bin/psql "sslmode=verify-full sslrootcert={{ general.tls_ca_directory }}/PostgreSQL.crt sslcert={{ general.tls_cert_directory }}/postgresql.crt sslkey={{ general.tls_key_directory }}/postgresql.key host={{ general.postgresql.pg_client_server_domainname }} user={{ general.postgresql.pg_client_username }} dbname={{ general.postgresql.pg_client_database }}" -c "\dt"; do sleep 1; done; echo "POSTGRESQL READY"'