| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/lve/modlscapi/user/ |
Upload File : |
# Copyright (c) Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2026 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
import configparser
def get_os_version():
"""
Detect system name and version
:return: tuple (os_name, os_ver)
"""
# # cat /etc/os-release | grep -E '^NAME|^VERSION_ID'
# NAME="Ubuntu"
# VERSION_ID="20.04"
# # cat /etc/os-release | grep -E '^NAME|^VERSION_ID'
# NAME="CloudLinux"
# VERSION_ID="7.9"
try:
os_release_filename = '/etc/os-release'
section_name = 'top'
config = configparser.ConfigParser()
# config.read('/etc/os-release')
with open(os_release_filename) as stream:
config.read_string(f"[{section_name}]\n" + stream.read())
os_name = config.get(section_name, 'NAME').strip('"')
os_ver = config.get(section_name, 'VERSION_ID').strip('"')
return os_name, os_ver
except (OSError, IOError, configparser.Error):
pass
return None, None
def is_ubuntu() -> bool:
"""
Detertmines is this system Ubuntu
:return: bool flag is_ubuntu
"""
os_name, _ = get_os_version()
return os_name == 'Ubuntu'