通过LINUX命令判断OS,DB,DNS,HOSTNAME等配置

来源:互联网 发布:网络调研 关于公共艺术 编辑:程序博客网 时间:2024/06/15 09:16
 

#! /bin/sh

#VERSION_COUNT=`cat /etc/SuSE-release | grep -c "VERSION = 10"`
PATCHLEVEL_COUNT=`cat /etc/SuSE-release | grep -c "SUSE Linux Enterprise Server 10 (x86_64)"`
if [ $PATCHLEVEL_COUNT==1 ]
then
  echo "OS_OK" >> a.txt
else
  echo "OS_FALSE" >> a.txt
fi

DB_VERSION=`echo $ORACLE_HOME | grep -c "11.1"`
if [ $DB_VERSION -gt 0 ] 
then
  echo "DB_OK" >> a.txt
else
  echo "DB_FALSE" >> a.txt
fi

HOST_NAME=`hostname`
if [ $HOST_NAME!='' ]
then
 echo "HOSTNAME_OK" >> a.txt
else
 echo "HOSTNAME_FALSE" >> a.txt
fi
 
sed -i 's/#nameserver/nameserver/g' /etc/resolv.conf
sed -i 's/nameserver/#nameserver/g' /etc/resolv.conf

TEMP_NUM=`cat a.txt | grep -c "OK"`
if [ $TEMP_NUM == 3 ]
then
    rm a.txt
    echo "ENV_SUCCESSFUL" >> a.txt
fi
cat a.txt
rm a.txt

原创粉丝点击