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