From 912a2fc75367233cfd951cf45ac4a8ac25906959 Mon Sep 17 00:00:00 2001 From: binhex Date: Mon, 21 Sep 2020 11:07:03 +0100 Subject: [PATCH] better logging for retries, set return not exit code --- run/nobody/qbittorrent.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/run/nobody/qbittorrent.sh b/run/nobody/qbittorrent.sh index 85c7ad8..7c8a936 100644 --- a/run/nobody/qbittorrent.sh +++ b/run/nobody/qbittorrent.sh @@ -11,7 +11,8 @@ if [[ "${qbittorrent_running}" == "false" ]]; then /usr/bin/qbittorrent-nox --daemon --webui-port="${WEBUI_PORT}" --profile=/config # make sure process qbittorrent-nox DOES exist - retry_count=30 + retry_count=12 + retry_wait=1 while true; do if ! pgrep -x "qbittorrent-nox" > /dev/null; then @@ -20,16 +21,17 @@ if [[ "${qbittorrent_running}" == "false" ]]; then if [ "${retry_count}" -eq "0" ]; then echo "[warn] Wait for qBittorrent process to start aborted, too many retries" - echo "[warn] Showing output from command before exit..." - timeout 10 yes | /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}" --profile=/config ; exit 1 + echo "[info] Showing output from command before exit..." + timeout 10 yes | /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}" --profile=/config ; return 1 else if [[ "${DEBUG}" == "true" ]]; then - echo "[debug] Waiting for qBittorrent process to start..." + echo "[debug] Waiting for qBittorrent process to start" + echo "[debug] Re-check in ${retry_wait} secs..." + echo "[debug] ${retry_count} retries left" fi - - sleep 1s + sleep "${retry_wait}s" fi