Linux系统巡检脚本
#!/bin/bash # auth:Bertram # created Time : 2019-12-26 # func:sys info check # sys:centos6.x/7.x ------------------------------------------------------------------------------------------------------------------------------------- [ $(id -u) -ne 0 ] && echo "请用root用户执行此脚本!" && exit 1 sysversion=$(rpm -q centos-release|cut -d- -f3) line="-------------------------------------------------" [ -d logs ] || mkdir logs #sys_check_file="logs/$(ip a show dev eth0|grep -w inet|awk '{print $2}'|awk -F '/' '{print $1}')-`date +%Y%m%d`.txt" sys_check_file="logs/$(ifconfig |awk 'NR==2{print $2}')-`date +%Y