#用户登陆显示cpu、负载、内存信息
#!/bin/
bash
#
hostip=`
ifconfig eth0 |
awk -F
" +|:" '/Bcast/{print $4}'`
date=`
date "+%F %T %A"`
load=`
uptime |
awk -F:
'{print $NF}'`
usage=`
df -h / |
awk 'NR==2{print $(NF-1)}'`
fssize=`
df -h / |
awk 'NR==2{print $2}'`
usernum=`
uptime |
awk '{print $4}'`
memused=`
free -k |
awk '/Mem/ {print $3/$2*100}'`%
echo -e
'\033[32;1m################ Welcome to Server #############################\033[0m'
cat <<
EOF
System information as of $date
System load: $load
Usage of /
: $usage of $fssize
Users logged in: $usernum users
Memory usage: $memused
IP address for eth0: $hostip
EOF
echo -e
'\033[32;1m#################################################################\033[0m'
把上面的文本cp到 /etc/profile.d/
1.
sh
然后chmod +x /etc/profile.d/
1.
sh
转载于:https://www.cnblogs.com/icemonkey/p/10447569.html
转载请注明原文地址: https://win8.8miu.com/read-950261.html