From 692a7a8b5019d524f18a457a54e74ee8d2e0caaf Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Thu, 29 Feb 2024 15:26:48 -0800 Subject: [PATCH] Disable debug `set -x` Mute compose config test Update logic for onlining stack --- homelab/fighter/scripts/startup.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/homelab/fighter/scripts/startup.sh b/homelab/fighter/scripts/startup.sh index 8a08efa7..11821c00 100644 --- a/homelab/fighter/scripts/startup.sh +++ b/homelab/fighter/scripts/startup.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +#set -x # debugging flag # Check for network mounted devices # NAS SMB @@ -25,7 +25,7 @@ fi for stack in /home/admin/homelab/fighter/config/*; do cd $stack - if ! docker compose config; then + if ! docker compose config > /dev/null; then echo " ==== Invalid compose config: $stack" fi COMPOSE_CONFIG_TEXT=$(docker compose config) @@ -37,17 +37,21 @@ for stack in /home/admin/homelab/fighter/config/*; do # need the one that must be offline. # If all of those fail, we know the stack is dependent on an offline service # So we just skip the stack. - if $SMB_ONLINE && $ISCSI_ONLINE; then + if ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/iscsi ) && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/nas); then + echo " ==== Stack not dependent on NAS services" echo " ==== Bringing up $stack" docker compose up -d + elif $SMB_ONLINE && $ISCSI_ONLINE; then + echo " ==== Bringing up $stack (all NAS services online)" + docker compose up -d elif $ISCSI_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/nas ); then - echo " ==== Bringing up $stack" + echo " ==== Bringing up $stack (iSCSI online, not dependent on SMB)" docker compose up -d elif $SMB_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/iscsi ); then - echo " ==== Bringing up $stack" + echo " ==== Bringing up $stack (SMB online, not dependent on iSCSI)" docker compose up -d else - echo " ==== Skipping stack $stack" + echo " ==== Skipping stack $stack (Dependent NAS service offline)" fi cd /home/admin/homelab/fighter/config/