Tuesday, 19 March 2013

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.

No comments:

Post a Comment