#!/bin/bash
os_check(){
if [ -e /etc/redhat-release ];then
REDHAT=`cat /etc/redhat-release |cut -d ' ' -f1`
else
DEBIAN=`cat /etc/issue |cut -d ' ' -f1`
fi
if [ "$REDHAT" == "CentOS" -o "$REDHAT" =="RED" ];then
P_M=yum
elif [ "$DEBIAN" == "Ubuntu" -o "$DEBIAN" =="ubuntu" ];then
P_M=apt-get
else
Operating system does not support.
exit 1
fi
}
if [ $LOGNAME != root ];then
echo "please use the root account operation."
exit 1
fi
if ! which vmstat &> /dev/null;then
echo "vmstat command not found,now the install."
sleep 1
os_check
$P_M install procps -y
echo