Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# one-time information grabs
cmd = "dpkg -l | awk '/openmediavault /{ print $3;} '"
omvpkg = subprocess.check_output(cmd, shell=True).decode("utf-8")
print("OMV Version: ", omvpkg)
# date / time
cmd = "date +\"%H:%M %d/%m/%Y\""
date = subprocess.check_output(cmd, shell=True).decode("utf-8")
print("Date: ", date)
# uptime
cmd = "uptime -p"
uptime = subprocess.check_output(cmd, shell=True).decode("utf-8")
cmd = "hostname"
hostname = subprocess.check_output(cmd, shell=True).decode("utf-8")
net_if_addrs = psutil.net_if_addrs()['eth0'][0]
IP = net_if_addrs.address
print("IP: ", IP)
netmask = net_if_addrs.netmask
print("Netmask: ", netmask)
cmd = "/sbin/route -n | awk '/UG/{ print $2;} '"
gateway = subprocess.check_output(cmd, shell=True).decode("utf-8")
print("Gateway: ", gateway)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.