linux服务器巡检脚本

效果如下linux服务器巡检脚本_第1张图片

代码如下

#!/bin/bash

BLK=''
RED=''
YEL=''
BLU=''
CYN=''
GRN=''
RES=''
BLD=''
#WHI=''
LNE='' 
clear

CPU=$(grep -m 1 "model name" /proc/cpuinfo | cut -d: -f2 | sed -e 's/^ *//' | sed -e 's/$//')
CPUS=$(grep -c ^processor /proc/cpuinfo)
STEP=$(grep -m 1 "stepping" /proc/cpuinfo | cut -d: -f2 | sed -e 's/^ *//' | sed -e 's/$//')
BOGO=$(grep -m 1 "bogomips" /proc/cpuinfo | cut -d: -f2 | sed -e 's/^ *//' | sed -e 's/$//')
ram=$(free -m | grep Mem | awk '{ printf "" $2 " MB\n\n" }')
VER=$(uname -a)
OS=$(lsb_release -si)
DISK=$(df -h --total | grep total |awk '{ printf "" $2 "B\n\n" }')
uptime=$( \033[00;33m${zile}${RES} | ${WHI}Ore \033[01;34m> \033[00;33m${ore}${RES} | ${WHI}Minute \033[01;34m> \033[00;33m${minute}${RES}\e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mRAM        \033[01;34m› ${WHI}${ram} \e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mDISK SPACE \033[01;34m› ${WHI}${DISK}\e[0m "   
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mPLACA VIDEO\033[01;34m› ${WHI}${vid}\e[0m"     
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mSTEPPING   \033[01;34m› ${WHI}${STEP}${RES}\e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mBOGOMIPS   \033[01;34m› ${WHI}${BOGO}${RES}\e[0m"        
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mUNAME      \033[01;34m› ${WHI}${VER}${RES}\e[0m"
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;32mSPEED TEST (WGET) in 3 secunde . \e[0m"
sleep 1
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96m 3 \e[0m"
sleep 1
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96m 2 \e[0m"
sleep 1
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96m 1 \e[0m"
sleep 2
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;33m Voi da WGET la SPEED TEST .  \e[0m"
sleep 2 
wget http://arhivecodex.tk/speed.py
clear
echo -e "\033[00;34m►\033[00;31m====================INFO SCRIPT BY CODEX=========================\033[00;34m◄"
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mUSER       \033[01;34m› ${WHI}$USER"
if ((${EUID:-0} || "$(id -u)")); then
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mDREPT      \033[01;34m› ${WHI}Nu ai " 
else
   echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mDREPT      \033[01;34m› ${WHI}Ai "
fi
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mCPU NAME   \033[01;34m› ${WHI}${CPU}${RES}\e[0m"             
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mCPUs       \033[01;34m› ${WHI}${CPUS}${RES}\e[0m"
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mOS         \033[01;34m› ${WHI}${OS}${RES}\e[0m"  
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mUPTIME     \033[01;34m› ${WHI}Zile \033[01;34m> \033[00;33m${zile}${RES} | ${WHI}Ore \033[01;34m> \033[00;33m${ore}${RES} | ${WHI}Minute \033[01;34m> \033[00;33m${minute}${RES}\e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mRAM        \033[01;34m› ${WHI}${ram} \e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mDISK SPACE \033[01;34m› ${WHI}${DISK}\e[0m "  
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mPLACA VIDEO\033[01;34m› ${WHI}${vid}\e[0m"        
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mSTEPPING   \033[01;34m› ${WHI}${STEP}${RES}\e[0m" 
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mBOGOMIPS   \033[01;34m› ${WHI}${BOGO}${RES}\e[0m"        
echo -e "\033[01;34m[\033[01;31m₪\033[01;34m]\033[01;35m► \033[00;96mUNAME      \033[01;34m› ${WHI}${VER}${RES}\e[0m"
perl speed.py

你可能感兴趣的:(linux服务器巡检脚本)