Use /proc/meminfo for memory stats

This commit is contained in:
Michael De Roover 2021-03-26 23:01:07 +01:00
parent 5c40a06ff7
commit 025fb615fc
Signed by: vim
GPG Key ID: 075496E232CE04CB
2 changed files with 7 additions and 2 deletions

View File

@ -13,8 +13,8 @@ mkconfig(){
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
[ ! -f ubot.py ] && echo "ubot.py not found, quitting." && exit 1
[ $0 != ./install ] && echo "Not launched from current directory." && exit 1
[ ! -f config.py ] && mkconfig
[ ! -f config.py ] && mkconfig
git pull
pip3 install -U telethon --user

View File

@ -106,9 +106,14 @@ async def edit(event):
await event.edit(rpl)
if msg.startswith('.sys'):
import os
from telethon import version
from platform import python_version
mem = os.popen('free -m').readlines()[1].split()[2]
mtot = open('/proc/meminfo').readlines()[0].split()[1]
mavl = open('/proc/meminfo').readlines()[2].split()[1]
mfree = (int(mtot) - int(mavl)) / 1024
mem = round(mfree, 1)
disk = os.popen('df -h /').readlines()[1].split()[2]
rpl = f'**System usage stats:**\n'