Shell Script To Display Logged in Users and Load:

To know current users and server load while login:

Place the below code in /root/.bashrc file,

a=$(cat /proc/loadavg | awk '{print $1}')
echo -e "\033[33;34m"
echo -e "Server load average is : $a\n"
b=$(who | awk '{print $1}' | wc -l)
echo -e "Current users : $b"
echo -e "\033[33;m"


Hereafter, You can find the load and current user info in each login.

Comments

Popular posts from this blog

Resolved: DOCKER: Error response from daemon: Could not attach to network / rpc error: code = 7 desc = network not manually attachable.

yum failed 6 times. Cannot continue!

unexpectedly shrunk window (repaired) in dmesg log - TCP Peer