Create timer

This commit is contained in:
Alexandre
2022-09-04 21:18:23 +02:00
committed by GitHub
parent d5c92bc289
commit 7315f91bf4

View File

@@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
RUNTIME=$(bashio::config 'run_duration')
if bashio::config.has_value 'run_duration'; then
bashio::log.warning "The run_duration option is set. The addon will stop after $RUNTIME"
sleep $RUNTIME || bashio::log.fatal "run_duration format is not correct. Use 5d or 5h or 5m for example"
bashio::log.info "Timeout achieved, addon will stop !"
sleep 60s
bashio::addon.stop
else
rm -r /etc/services.d/timer
fi