From bb64ea8c2b8a6e46f3ce798f2c6cd9d4e7efc8e5 Mon Sep 17 00:00:00 2001 From: Suhail Haris Date: Sat, 21 Jan 2023 17:42:38 +0530 Subject: [PATCH] Suppress Error messages on VM check --- yabs.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yabs.sh b/yabs.sh index fb71e19..375f8f3 100644 --- a/yabs.sh +++ b/yabs.sh @@ -82,11 +82,11 @@ check_virt() { sys_product="" sys_ver="" fi - if grep -qa docker /proc/1/cgroup; then + if grep -qa docker /proc/1/cgroup 2>/dev/null; then VIRT="Docker" - elif grep -qa lxc /proc/1/cgroup; then + elif grep -qa lxc /proc/1/cgroup 2>/dev/null; then VIRT="LXC" - elif grep -qa container=lxc /proc/1/environ; then + elif grep -qa container=lxc /proc/1/environ 2>/dev/null; then VIRT="LXC" elif [[ -f /proc/user_beancounters ]]; then VIRT="OpenVZ" @@ -123,7 +123,7 @@ check_virt() { fi fi else - VIRT="Dedicated" + VIRT="Dedicated/Unknown" fi }