This commit is contained in:
Alexandre
2023-05-21 10:47:05 +02:00
parent 738cba2977
commit b82721ab6a
5 changed files with 34 additions and 26 deletions

View File

@@ -1,16 +0,0 @@
#!/bin/bash
echo "Starting..."
####################
# Starting scripts #
####################
for SCRIPTS in /etc/cont-init.d/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x "$SCRIPTS"
# Change shebang if no s6 supervision
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
done

View File

@@ -0,0 +1,7 @@
#!/usr/bin/with-contenv bash
if [ -f "/tmp/healthcheck-signal" ]; then
curl -k --fail https://127.0.0.1:9001/ping || exit 1
else
touch /tmp/healthcheck-signal
fi

View File

@@ -0,0 +1,21 @@
#!/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