check if VM is already running before deploying

This commit is contained in:
mischa 2024-05-21 10:50:01 +00:00
parent db076d5a34
commit c40181bf7b
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,11 @@ else
chmod 600 ${VMS}/${1}.txt
fi
if vmctl show ${1} | grep running >/dev/null 2>&1; then
echo "ERR: VM ${1} is already running..."
exit 1
fi
INSTANCE=$(awk -F'=' '/^instance/ {print $2}' ${VMS}/${1}.txt | tr -d '"')
if [[ -z ${INSTANCE} ]]; then
INSTANCE=${1}