From d042249bcc91ab2c574c3ea17aadaf5447fec2cf Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 14 Mar 2023 23:53:00 +0000 Subject: [PATCH] Only check https if it's enabled --- .../s6-overlay/s6-rc.d/svc-sabnzbd/data/check | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/svc-sabnzbd/data/check b/root/etc/s6-overlay/s6-rc.d/svc-sabnzbd/data/check index 48a9f9d..3b95451 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-sabnzbd/data/check +++ b/root/etc/s6-overlay/s6-rc.d/svc-sabnzbd/data/check @@ -2,17 +2,26 @@ if [[ -f "/config/sabnzbd.ini" ]]; then WEBUI_PORT=$(grep -m1 '^port =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") - if [[ $(grep -m1 '^https_port =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") = '""' ]]; then - WEBUI_HTTPS_PORT=${WEBUI_PORT} - else - WEBUI_HTTPS_PORT=$(grep -m1 '^https_port =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") + if [[ $(grep -m1 '^enable_https =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") == '1' ]]; then + HTTPS_ENABLED=1 + if [[ $(grep -m1 '^https_port =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") == '""' ]]; then + WEBUI_HTTPS_PORT=${WEBUI_PORT} + else + WEBUI_HTTPS_PORT=$(grep -m1 '^https_port =' /config/sabnzbd.ini | awk -F '=' '{print $2}' | tr -d "[:space:]") + fi fi fi -if curl -skL "https://localhost:${WEBUI_HTTPS_PORT:-8080}/sabnzbd/api?mode=version" > /dev/null 2>&1; then - exit 0 -elif curl -skL "http://localhost:${WEBUI_PORT:-8080}/sabnzbd/api?mode=version" > /dev/null 2>&1; then - exit 0 +if [[ ${HTTPS_ENABLED} == 1 ]]; then + if curl -skL "https://localhost:${WEBUI_HTTPS_PORT:-8080}/sabnzbd/api?mode=version" > /dev/null 2>&1; then + exit 0 + else + exit 1 + fi else - exit 1 + if curl -skL "http://localhost:${WEBUI_PORT:-8080}/sabnzbd/api?mode=version" > /dev/null 2>&1; then + exit 0 + else + exit 1 + fi fi