Use /proc/meminfo for memory stats
This commit is contained in:
parent
5c40a06ff7
commit
025fb615fc
2
install
2
install
@ -13,8 +13,8 @@ mkconfig(){
|
|||||||
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
|
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
|
||||||
[ ! -f ubot.py ] && echo "ubot.py not found, quitting." && exit 1
|
[ ! -f ubot.py ] && echo "ubot.py not found, quitting." && exit 1
|
||||||
[ $0 != ./install ] && echo "Not launched from current directory." && exit 1
|
[ $0 != ./install ] && echo "Not launched from current directory." && exit 1
|
||||||
[ ! -f config.py ] && mkconfig
|
|
||||||
|
|
||||||
|
[ ! -f config.py ] && mkconfig
|
||||||
git pull
|
git pull
|
||||||
pip3 install -U telethon --user
|
pip3 install -U telethon --user
|
||||||
|
|
||||||
|
7
ubot.py
7
ubot.py
@ -106,9 +106,14 @@ async def edit(event):
|
|||||||
await event.edit(rpl)
|
await event.edit(rpl)
|
||||||
|
|
||||||
if msg.startswith('.sys'):
|
if msg.startswith('.sys'):
|
||||||
|
import os
|
||||||
from telethon import version
|
from telethon import version
|
||||||
from platform import python_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]
|
disk = os.popen('df -h /').readlines()[1].split()[2]
|
||||||
|
|
||||||
rpl = f'**System usage stats:**\n'
|
rpl = f'**System usage stats:**\n'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user