Influxdb retention policy

When I bring up a new system (using systemctl) I want to set retention policies.
The problem is that:
/usr/bin/influx --execute ‘create retention policy “telegraf1Day” on “telegraf” DURATION 1d REPLICATION 1 default’

will fail with database not found: telegraf
until I wait for everything to come up.
I can’t find anything that discusses what I should be waiting for before I run the command.
The command itself doesn’t return an error value $? so I event add retries to it.

How do people do this when spinning up a new system.

Thanks for any help,

The create database command is idempotent, so you could include it.

My rough guess that by “everything to come up” you should monitor /var/log/influxdb/influxd.log or journalctl -f -u influxdb
When you startup influxd it’s processing/opening all shards. Before that completes you are unable to read or write any data into it.