From a1d9de0a044d418cec29a3727b13e50d2dbaa6f3 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 13 Sep 2021 21:46:59 +0200 Subject: [PATCH] Create autostop --- qbittorrent/rootfs/etc/services.d/autostop | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 qbittorrent/rootfs/etc/services.d/autostop diff --git a/qbittorrent/rootfs/etc/services.d/autostop b/qbittorrent/rootfs/etc/services.d/autostop new file mode 100644 index 000000000..4e32a7003 --- /dev/null +++ b/qbittorrent/rootfs/etc/services.d/autostop @@ -0,0 +1,17 @@ +#!/usr/bin/with-contenv bashio + +########### +# TIMEOUT # +########### + +if bashio::config.has_value 'run_duration'; then + RUNTIME=$(bashio::config 'run_duration') + bashio::log.info "Addon will stop after $RUNTIME" + sleep $RUNTIME && \ + bashio::log.info "Timeout achieved, addon will stop !" && \ + if -n { s6-test $# -ne 0 } + if -n { s6-test ${1} -eq 256 } + s6-svscanctl -t /var/run/s6/services +else + bashio::log.info "run_duration option not defined, addon will run continuously" +fi