From 7a52ee8af2968f666e20512122b51c56c8f8ab0d Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Sun, 11 May 2025 23:41:39 +0200 Subject: [PATCH] add check vm exist Signed-off-by: GnomeZworc --- lib/qemu.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/qemu.sh b/lib/qemu.sh index c79f642..cec61db 100644 --- a/lib/qemu.sh +++ b/lib/qemu.sh @@ -4,6 +4,17 @@ . ./lib/colors.sh . ./lib/db.sh +function check_qemu_exist { + local vm_name="${1}" + + print_in_color "${COLOR_GREY}" "Check in db if ${vm_name} exist" + check_in_db "vm" "${vm_name}" + [ "$?" -eq "0" ] || return 1 + ps aux | grep -v grep | grep "${vm_name}" > /dev/null || return 1 + return 0 + +} + function create_tap { local tap_id="${1}" local bridge_name="${2}"