Files
hassio-addons/portainer_agent/rootfs/usr/sbin/wait-for-signal
Alexandre 07a2c697ea test
2023-05-21 11:28:35 +02:00

21 lines
469 B
Plaintext

#!/usr/bin/with-contenv bashio
START_TIME="$(date +%s)"
echo "Waiting for first healthcheck execution (max $FIRST_HEALTHCHECK_TIMEOUT seconds)..."
while [ ! -f "/tmp/healthcheck-signal" ];
do
sleep 1
ELAPSED_TIME="$(expr \date +%s\ - $START_TIME)"
if [ $ELAPSED_TIME -gt $FIRST_HEALTHCHECK_TIMEOUT ]
then
echo "Signal from healthcheck not received in time, failing the execution..."
exit 20
fi
done
echo "Signal from healthcheck received"
exit 0