Try timeout option

This commit is contained in:
Alexandre
2021-05-13 07:25:12 +02:00
committed by GitHub
parent 7af9bb1c53
commit 2a99aacb75

View File

@@ -26,7 +26,7 @@ UPSTREAM=$(bashio::config 'upstream')
mv -f /data/joal/config.json / || true
curl -s -S -L -o /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/${UPSTREAM}/joal.tar.gz" >/dev/null
curl -L -o /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/${UPSTREAM}/joal.tar.gz"
mkdir -p /data/joal
tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null
chown -R $(id -u):$(id -g) /data/joal
@@ -41,6 +41,19 @@ mv -f /config.json /data/joal/ || true
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="joal" --joal.ui.secret-token=$TOKEN \
& bashio::log.info "... Joal started with secret token $TOKEN"
# Wait for transmission to become available
bashio::net.wait_for 8081 localhost 900
bashio::log.info "... starting NGinx"
exec nginx || bashio::log.fatal "... Nginx not started, only access through webui available"
bashio::net.wait_for 8081 localhost 900 || true
exec nginx || bashio::log.fatal "... Nginx not started, only access through webui available" \
& bashio::log.info "... Nginx started for Ingress"
###########
# TIMEOUT #
###########
if bashio::config.has_value 'run_for_hours'; then
RUNTIME=$(bashio::config 'run_for_hours')
bashio::log.info "... Addon will stop after $RUNTIME hours"
sleep $TIMEOUT && kill "$PID"
else
bashio::log.info "... run_for_hours option not defined, addon will run continuously
fi"