diff --git a/joal/rootfs/run.sh b/joal/rootfs/run.sh index 86fc8ba81..3a3218327 100644 --- a/joal/rootfs/run.sh +++ b/joal/rootfs/run.sh @@ -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" +