系统登录执行默认脚本展现系统信息

每次登录系统会执行脚本统计当前系统运行状态,脚本位置在/etc/profile.d目录下

脚本内容:

echo -ne "\033[0;33m"
IP=`hostname -i`
Load=`top -b -n 1 |head -n 1|awk -F "load average:" '{print $2}'|awk -F ',' '{print $1}'|awk -F ' ' '{print $1}'`
Processes=`ps -ef  | wc -l`
LoginUser=`whoami`
echo "================================================================="
echo "IP ADDRESS : $IP  ||  HOSTNAME : $HOSTNAME"
echo "System load: $Load        ||  Processes: $Processes"
echo CPU: `lscpu | grep On-line`
echo "Login  User: $LoginUser"
echo "================================================================="
echo ""
df -h|grep -v "shm"|grep -v "boot" | grep -v "tmpfs" | grep -v "overlay"  | grep -v "devicemapper"
echo "================================================================="
echo "inode:"
df -hi|grep -v "shm"|grep -v "boot"| grep -v "tmpfs" | grep -v "overlay" | grep -v "devicemapper"
echo -ne "\033[m"
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注