Code: Alles auswählen
chmod +x /usr/lib/influxdb/scripts/influxd-systemd-start.sh
Falls danach die influxDB noch nicht startet, dann bitte in der Datei
/usr/lib/influxdb/script/influxd-systemd-start.sh
die Zeile "sleep 1" in "sleep 5" ändern.
Das ist bei den nicht so schnellen Raspberry Modellen nötig.
Code: Alles auswählen
#!/bin/bash -e
/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS &
PID=$!
echo $PID > /var/lib/influxdb/influxd.pid
PROTOCOL="http"
BIND_ADDRESS=$(influxd config | grep -A5 "\[http\]" | grep '^ bind-address' | cut -d ' ' -f5 | tr -d '"')
HTTPS_ENABLED_FOUND=$(influxd config | grep "https-enabled = true" | cut -d ' ' -f5)
HTTPS_ENABLED=${HTTPS_ENABLED_FOUND:-"false"}
if [ $HTTPS_ENABLED = "true" ]; then
HTTPS_CERT=$(influxd config | grep "https-certificate" | cut -d ' ' -f5 | tr -d '"')
if [ ! -f "${HTTPS_CERT}" ]; then
echo "${HTTPS_CERT} not found! Exiting..."
exit 1
fi
echo "$HTTPS_CERT found"
PROTOCOL="https"
fi
HOST=${BIND_ADDRESS%%:*}
HOST=${HOST:-"localhost"}
PORT=${BIND_ADDRESS##*:}
set +e
max_attempts=10
url="$PROTOCOL://$HOST:$PORT/health"
result=$(curl -k -s -o /dev/null $url -w %{http_code})
while [ "$result" != "200" ]; do
sleep 1
result=$(curl -k -s -o /dev/null $url -w %{http_code})
max_attempts=$(($max_attempts-1))
if [ $max_attempts -le 0 ]; then
echo "Failed to reach influxdb $PROTOCOL endpoint at $url"
exit 1
fi
done
set -e