From 1570fd588ea491b906ca611fdd0da704af6cdc93 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 28 Jan 2021 23:40:37 +0100 Subject: [PATCH] fix: display disabled octoprint services as installed, and show the number of instances --- scripts/status.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index c1cbd25..df5babf 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -174,16 +174,12 @@ octoprint_status(){ $OCTOPRINT_DIR ) #remove the "SERVICE" entry from the octoprint array if an octoprint service is installed - if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "octoprint.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "octoprint-[[:digit:]].service")" ]; then + if systemctl list-unit-files | grep -E "octoprint.*" &>/dev/null; then unset octoprint_data[0] fi ### count amount of octoprint services - if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "octoprint.service")" ]; then - instances=1 - else - instances=$(systemctl list-units --full -all -t service --no-legend | grep -E "octoprint-[[:digit:]].service" | wc -l) - fi + instances=$(systemctl list-unit-files | grep -E "octoprint.*" | wc -l) #count+1 for each found data-item from array for op in "${octoprint_data[@]}"