From 7bf1ef80b1180668a84e4a8f831940b8c1fbcf96 Mon Sep 17 00:00:00 2001 From: MrDoobPG <46342172+MrDoobPG@users.noreply.github.com> Date: Mon, 25 Nov 2019 19:43:58 +0100 Subject: [PATCH] update plex_autoscan read lines edit to first execute if file exist then read plex_autoscan section --- menu/pgscan/pgscan.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/menu/pgscan/pgscan.sh b/menu/pgscan/pgscan.sh index b794efc9..a93f4b16 100644 --- a/menu/pgscan/pgscan.sh +++ b/menu/pgscan/pgscan.sh @@ -24,18 +24,18 @@ userstatus() { } tokenstatus() { - ptokendep=$(cat /var/plexguide/pgscan/plex.token) - PGSELFTEST=$(curl -LI "http://localhost:32400/system?X-Plex-Token=$(cat /opt/plex_autoscan/config/config.json | jq .PLEX_TOKEN | sed 's/"//g')" -o /dev/null -w '%{http_code}\n' -s) + ptokendep=$(cat /var/plexguide/pgscan/plex.token) if [ "$ptokendep" != "" ]; then - if [ ! -f "/opt/plex_autoscan/config/config.json" ]; then + if [[ ! -f "/opt/plex_autoscan/config/config.json" ]]; then pstatus="❌ DEPLOYED BUT PAS CONFIG MISSING"; - elif [[ $PGSELFTEST -ge 200 && $PGSELFTEST -le 299 ]]; then - pstatus="✅ DEPLOYED" else - pstatus="❌ DEPLOYED BUT PAS TOKEN FAILED" + PGSELFTEST=$(curl -LI "http://localhost:32400/system?X-Plex-Token=$(cat /opt/plex_autoscan/config/config.json | jq .PLEX_TOKEN | sed 's/"//g')" -o /dev/null -w '%{http_code}\n' -s) + if [[ $PGSELFTEST -ge 200 && $PGSELFTEST -le 299 ]]; then pstatus="✅ DEPLOYED" + else pstatus="❌ DEPLOYED BUT PAS TOKEN FAILED"; fi fi else pstatus="⚠️ NOT DEPLOYED"; fi + } plexcheck() {