#!/bin/bash fetchstatus() { curl \ -o /dev/null \ --silent \ --head \ --write-out '%{http_code}' \ "http://grafana:3000/login" } echo "Waitung until Grafana is ready..." urlstatus=$(fetchstatus) # initialize to actual value before we sleep even once until [ "$urlstatus" = 200 ]; do # until our result is success... sleep 1 # wait a second... urlstatus=$(fetchstatus) # then poll again. echo $urlstatus done echo "Grafana is ready" curl --request POST \ --url http://grafana:3000/api/admin/users \ --header 'authorization: Basic YWRtaW46V3hQWVZ4NTM=' \ --header 'content-type: application/json' \ --data '{ "name":"OMI", "email":"no@example-com", "login":"guest", "password":"kiz123" }'