Suppress Error messages on VM check

This commit is contained in:
Suhail Haris 2023-01-21 17:42:38 +05:30
commit bb64ea8c2b
No known key found for this signature in database
GPG key ID: 8E225274EDCBF899

View file

@ -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
}