fix memory status

This commit is contained in:
root 2014-12-19 13:14:08 +01:00
parent 84d4d7c4fe
commit 166e9a217f

View File

@ -1,6 +1,5 @@
#!/bin/bash
#Script to update motd with relevant information.
#Define output file
motd="/etc/motd"
@ -15,8 +14,7 @@ CPU_TEMP=$(($(</sys/class/thermal/thermal_zone0/temp) / 1000))
ARCH=`uname -m`
PACMAN=`pacman -Qu | wc -l`
DISC=`df -hT | awk '/md0/ {print $4 "/" $3 " (" $6 ")" }'`
MEMORY1=`free -t -m | grep "buffers/cache" | awk '{print $3" MB";}'`
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'`
MEMORY=`free -m -t | awk 'NR==2 { printf "%sMB / %sMB\n", $3, $2 }'`
PSA=`ps -Afl | wc -l`
PSU=`ps U $USER h | wc -l`
@ -63,7 +61,7 @@ echo -e " $R USERS $W= Currently `users | wc -w` users logged on " >> $mot
echo -e "$R===============================================================" >> $motd
echo -e " $R CPU Usage $W= $LOAD1 1 min $LOAD5 5 min $LOAD15 15 min " >> $motd
echo -e " $R CPU Temperature $W= $CPU_TEMP" >> $motd
echo -e " $R Memory Used $W= $MEMORY1 / $MEMORY2 " >> $motd
echo -e " $R Memory Used $W= $MEMORY " >> $motd
echo -e " $R Swap in use $W= `free -m | tail -n 1 | awk '{print $3}'` MB " >> $motd
echo -e " $R Processes $W= You are running $PSU of $PSA processes " >> $motd
echo -e " $R System Uptime $W= $upDays days $upHours hours $upMins minutes $upSecs seconds " >> $motd