日常脚本更新。

1、输出服务器的基本信息。

#!/bin/bash
#
#********************************************************************
#Author: xiaoxie
#Date: 2022-03-04
#Description: Show system information
#********************************************************************


COLOR="\033[1;32m"
END="\033[0m"
echo -e "\033[1;31m-----------------Host systeminfo---------------$END"
echo -e "HOSTNAME:   $COLOR`hostname`$END"
echo -e "IPADDR:    $COLOR` ifconfig ens32|grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' |head -n1`$END"
echo -e "OSVERSION:  $COLOR`cat /etc/redhat-release`$END"
echo -e "KERNEL:    $COLOR`uname -r`$END"
echo -e "CPU:     $COLOR`lscpu|grep 'Model name'|tr -s ' '|cut -d : -f2`$END"
echo -e "MEMORY:    $COLOR`free -h|grep Mem|tr -s ' ' : |cut -d : -f2`$END"
echo -e "DISK:     $COLOR`lsblk |grep '^sd' |tr -s ' ' |cut -d " " -f4`$END"

 

posted @ 2022-03-04 10:57  杰尔克  阅读(38)  评论(0编辑  收藏  举报