[Unit] Description=Create secrets if they don't exist ConditionPathExists=!/home/core/postgresql/secret [Service] Type=oneshot ExecStart=/bin/bash -c 'echo "POSTGRES_PASSWORD=$(/usr/bin/openssl rand -base64 20)" > /home/core/postgresql/secret' [Install] WantedBy=sysinit.target