From f5fef01a0cba6d6dbaba905beececdb0f951ceff Mon Sep 17 00:00:00 2001 From: Alexandre LE GALL Date: Sat, 17 Jul 2021 22:00:38 +0200 Subject: [PATCH] =?UTF-8?q?balance-containers:=20ne=20pas=20d=C3=A9marrer?= =?UTF-8?q?=20le=20conteneur=20si=20il=20=C3=A9tait=20=C3=A9teint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance-containers/run.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/balance-containers/run.bash b/balance-containers/run.bash index 24f5f3c..fc9a0f5 100755 --- a/balance-containers/run.bash +++ b/balance-containers/run.bash @@ -35,9 +35,13 @@ move_ct() { [[ $? -eq 0 ]] && echo "success" || echo "failed" # Démarrer - echo -n " start: " - lxc start $ct 2> /dev/null - [[ $? -eq 0 ]] && echo "success" || echo "failed" + if [[ $(lxc list --columns s --format csv $ct 2> /dev/null) == "RUNNING" ]]; then + echo -n " start: " + lxc start $ct 2> /dev/null + [[ $? -eq 0 ]] && echo "success" || echo "failed" + else + echo " start: skipped" + fi } # Boucler sur les arguments