From d19c4d33cbf99fbb4a2a89796e17431c8b2016c1 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 16:33:44 +0200 Subject: [PATCH] Fix OctoPrint toggle function --- scripts/functions.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index d7b3079..f9919af 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -229,14 +229,18 @@ disable_octoprint_service(){ } toggle_octoprint_service(){ - if systemctl is-enabled octoprint.service -q; then - disable_octoprint_service - sleep 2 - CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" + if [[ -f $OCTOPRINT_SERVICE1 && -f $OCTOPRINT_SERVICE2 ]]; then + if systemctl is-enabled octoprint.service -q; then + disable_octoprint_service + sleep 2 + CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" + else + enable_octoprint_service + sleep 2 + CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" + fi else - enable_octoprint_service - sleep 2 - CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" + ERROR_MSG=" You cannot activate a service that does not exist!" fi }