Streamline /stat with userbot's .sys command

This commit is contained in:
Michael De Roover 2021-03-28 18:34:59 +02:00
parent 2bf5420f5b
commit 2610afb304
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -242,14 +242,20 @@ mp3(){
fi
}
stat(){
sys(){
admin
total=$(grep MemTotal /proc/meminfo | awk '{print $2}')
avail=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
used=$(bc <<< "scale=1; ($total-$avail) / 1024")
sendmsg "$(uptime | cut -c2-)
I am using ${used}M of memory and \
$(df -h / | tail -n1 | awk '{print $3}') of storage."
mtot=$(grep MemTotal /proc/meminfo | awk '{print $2}')
mavl=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
mem=$(bc <<< "scale=1; ($mtot-$mavl) / 1024")
ups=$(cut -d. -f1 < /proc/uptime)
upd=$(bc <<< "$ups / 60 / 60 / 24")
disk=$(df -h / | tail -n1 | awk '{print $3}')
load=$(cut -d' ' -f1,2,3 < /proc/loadavg)
sendmsg "*System usage stats:*
*Memory:* ${mem}M
*Disk:* ${disk}
*Uptime:* ${upd}d
*Load:* ${load}"
}
neo(){
@ -294,7 +300,7 @@ case "$cmd" in
/repo@$bot) repo ;;
# Administrative
/mp3@$bot*) mp3 ;;
/stat@$bot) stat ;;
/sys@$bot) sys ;;
/neo@$bot) neo ;;
/term@$bot*) term ;;
# Notes and such