Liunx各系统中间件查询脚本

Centos 6

#!/bin/bash

echo "CentOS 6 系统软件信息收集"

# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release

# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; then
    java -version
    which java
    if ps -ef | grep -v grep | grep java > /dev/null; then
        echo "JDK 服务正在运行。"
    else
        echo "JDK 服务未运行。"
    fi
else
    echo "未找到JDK。"
fi

# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; then
    httpd -v
    which httpd
    if ps -ef | grep -v grep | grep httpd > /dev/null; then
        echo "Apache HTTP Server 服务正在运行。"
    else
        echo "Apache HTTP Server 服务未运行。"
    fi
else
    echo "未找到Apache HTTP Server。"
fi

# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; then
    nginx -v
    which nginx
    if ps -ef | grep -v grep | grep nginx > /dev/null; then
        echo "NGINX 服务正在运行。"
    else
        echo "NGINX 服务未运行。"
    fi
else
    echo "未找到NGINX。"
fi

# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then
    /srv/tomcat/bin/version.sh
    echo "Tomcat路径:/srv/tomcat"
    if ps -ef | grep -v grep | grep tomcat > /dev/null; then
        echo "Tomcat 服务正在运行。"
    else
        echo "Tomcat 服务未运行。"
    fi
else
    echo "未找到Tomcat。"
fi

# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; then
    redis-server -v
    which redis-server
    if ps -ef | grep -v grep | grep redis-server > /dev/null; then
        echo "Redis 服务正在运行。"
    else
        echo "Redis 服务未运行。"
    fi
else
    echo "未找到Redis。"
fi

# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; then
    echo "Kafka 已安装。"
    which kafka-server-start
    if ps -ef | grep -v grep | grep kafka > /dev/null; then
        echo "Kafka 服务正在运行。"
    else
        echo "Kafka 服务未运行。"
    fi
else
    echo "未找到Kafka。"
fi

# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; then
    rabbitmqctl status
    which rabbitmqctl
    if ps -ef | grep -v grep | grep rabbitmq > /dev/null; then
        echo "RabbitMQ 服务正在运行。"
    else
        echo "RabbitMQ 服务未运行。"
    fi
else
    echo "未找到RabbitMQ。"
fi

# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then
    /opt/activemq/bin/activemq --version
    echo "ActiveMQ路径:/opt/activemq"
    if ps -ef | grep -v grep | grep activemq > /dev/null; then
        echo "ActiveMQ 服务正在运行。"
    else
        echo "ActiveMQ 服务未运行。"
    fi
else
    echo "未找到ActiveMQ。"
fi

# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; then
    zkServer.sh status
    which zkServer.sh
    if ps -ef | grep -v grep | grep zookeeper > /dev/null; then
        echo "Zookeeper 服务正在运行。"
    else
        echo "Zookeeper 服务未运行。"
    fi
else
    echo "未找到Zookeeper。"
fi

# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; then
    echo "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"
    if ps -ef | grep -v grep | grep spring > /dev/null; then
        echo "Spring Framework 服务可能正在运行。"
    else
        echo "Spring Framework 服务可能未运行。"
    fi
else
    echo "未找到Spring Framework。"
fi

# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; then
    echo "Hibernate 可能已安装。"
    if ps -ef | grep -v grep | grep hibernate > /dev/null; then
        echo "Hibernate 服务可能正在运行。"
    else
        echo "Hibernate 服务可能未运行。"
    fi
else
    echo "未找到Hibernate。"
fi

# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; then
    docker --version
    which docker
    if ps -ef | grep -v grep | grep docker > /dev/null; then
        echo "Docker 服务正在运行。"
    else
        echo "Docker 服务未运行。"
    fi
else
    echo "未找到Docker。"
fi

# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; then
    kubectl version --client
    which kubectl
    if ps -ef | grep -v grep | grep kube > /dev/null; then
        echo "Kubernetes 服务正在运行。"
    else
        echo "Kubernetes 服务未运行。"
    fi
else
    echo "未找到Kubernetes。"
fi

Centos 7

#!/bin/bash

echo "CentOS 7 系统软件信息收集"

# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release

# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; then
    java -version
    which java
    if ps -ef | grep -v grep | grep java > /dev/null; then
        echo "JDK 服务正在运行。"
    else
        echo "JDK 服务未运行。"
    fi
else
    echo "未找到JDK。"
fi

# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; then
    httpd -v
    which httpd
    if ps -ef | grep -v grep | grep httpd > /dev/null; then
        echo "Apache HTTP Server 服务正在运行。"
    else
        echo "Apache HTTP Server 服务未运行。"
    fi
else
    echo "未找到Apache HTTP Server。"
fi

# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; then
    nginx -v
    which nginx
    if ps -ef | grep -v grep | grep nginx > /dev/null; then
        echo "NGINX 服务正在运行。"
    else
        echo "NGINX 服务未运行。"
    fi
else
    echo "未找到NGINX。"
fi

# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then
    /srv/tomcat/bin/version.sh
    echo "Tomcat路径:/srv/tomcat"
    if ps -ef | grep -v grep | grep tomcat > /dev/null; then
        echo "Tomcat 服务正在运行。"
    else
        echo "Tomcat 服务未运行。"
    fi
else
    echo "未找到Tomcat。"
fi

# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; then
    redis-server -v
    which redis-server
    if ps -ef | grep -v grep | grep redis-server > /dev/null; then
        echo "Redis 服务正在运行。"
    else
        echo "Redis 服务未运行。"
    fi
else
    echo "未找到Redis。"
fi

# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; then
    echo "Kafka 已安装。"
    which kafka-server-start
    if ps -ef | grep -v grep | grep kafka > /dev/null; then
        echo "Kafka 服务正在运行。"
    else
        echo "Kafka 服务未运行。"
    fi
else
    echo "未找到Kafka。"
fi

# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; then
    rabbitmqctl status
    which rabbitmqctl
    if ps -ef | grep -v grep | grep rabbitmq > /dev/null; then
        echo "RabbitMQ 服务正在运行。"
    else
        echo "RabbitMQ 服务未运行。"
    fi
else
    echo "未找到RabbitMQ。"
fi

# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then
    /opt/activemq/bin/activemq --version
    echo "ActiveMQ路径:/opt/activemq"
    if ps -ef | grep -v grep | grep activemq > /dev/null; then
        echo "ActiveMQ 服务正在运行。"
    else
        echo "ActiveMQ 服务未运行。"
    fi
else
    echo "未找到ActiveMQ。"
fi

# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; then
    zkServer.sh status
    which zkServer.sh
    if ps -ef | grep -v grep | grep zookeeper > /dev/null; then
        echo "Zookeeper 服务正在运行。"
    else
        echo "Zookeeper 服务未运行。"
    fi
else
    echo "未找到Zookeeper。"
fi

# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; then
    echo "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"
    if ps -ef | grep -v grep | grep spring > /dev/null; then
        echo "Spring Framework 服务可能正在运行。"
    else
        echo "Spring Framework 服务可能未运行。"
    fi
else
    echo "未找到Spring Framework。"
fi

# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; then
    echo "Hibernate 可能已安装。"
    if ps -ef | grep -v grep | grep hibernate > /dev/null; then
        echo "Hibernate 服务可能正在运行。"
    else
        echo "Hibernate 服务可能未运行。"
    fi
else
    echo "未找到Hibernate。"
fi

# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; then
    docker --version
    which docker
    if ps -ef | grep -v grep | grep docker > /dev/null; then
        echo "Docker 服务正在运行。"
    else
        echo "Docker 服务未运行。"
    fi
else
    echo "未找到Docker。"
fi

# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; then
    kubectl version --client
    which kubectl
    if ps -ef | grep -v grep | grep kube > /dev/null; then
        echo "Kubernetes 服务正在运行。"
    else
        echo "Kubernetes 服务未运行。"
    fi
else
    echo "未找到Kubernetes。"
fi

Rocky 8

#!/bin/bash

echo "Rocky Linux 8 系统软件信息收集"

# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release

# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; then
    java -version
    which java
    if ps -ef | grep -v grep | grep java > /dev/null; then
        echo "JDK 服务正在运行。"
    else
        echo "JDK 服务未运行。"
    fi
else
    echo "未找到JDK。"
fi

# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; then
    httpd -v
    which httpd
    if ps -ef | grep -v grep | grep httpd > /dev/null; then
        echo "Apache HTTP Server 服务正在运行。"
    else
        echo "Apache HTTP Server 服务未运行。"
    fi
else
    echo "未找到Apache HTTP Server。"
fi

# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; then
    nginx -v
    which nginx
    if ps -ef | grep -v grep | grep nginx > /dev/null; then
        echo "NGINX 服务正在运行。"
    else
        echo "NGINX 服务未运行。"
    fi
else
    echo "未找到NGINX。"
fi

# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then
    /srv/tomcat/bin/version.sh
    echo "Tomcat路径:/srv/tomcat"
    if ps -ef | grep -v grep | grep tomcat > /dev/null; then
        echo "Tomcat 服务正在运行。"
    else
        echo "Tomcat 服务未运行。"
    fi
else
    echo "未找到Tomcat。"
fi

# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; then
    redis-server -v
    which redis-server
    if ps -ef | grep -v grep | grep redis-server > /dev/null; then
        echo "Redis 服务正在运行。"
    else
        echo "Redis 服务未运行。"
    fi
else
    echo "未找到Redis。"
fi

# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; then
    echo "Kafka 已安装。"
    which kafka-server-start
    if ps -ef | grep -v grep | grep kafka > /dev/null; then
        echo "Kafka 服务正在运行。"
    else
        echo "Kafka 服务未运行。"
    fi
else
    echo "未找到Kafka。"
fi

# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; then
    rabbitmqctl status
    which rabbitmqctl
    if ps -ef | grep -v grep | grep rabbitmq > /dev/null; then
        echo "RabbitMQ 服务正在运行。"
    else
        echo "RabbitMQ 服务未运行。"
    fi
else
    echo "未找到RabbitMQ。"
fi

# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then
    /opt/activemq/bin/activemq --version
    echo "ActiveMQ路径:/opt/activemq"
    if ps -ef | grep -v grep | grep activemq > /dev/null; then
        echo "ActiveMQ 服务正在运行。"
    else
        echo "ActiveMQ 服务未运行。"
    fi
else
    echo "未找到ActiveMQ。"
fi

# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; then
    zkServer.sh status
    which zkServer.sh
    if ps -ef | grep -v grep | grep zookeeper > /dev/null; then
        echo "Zookeeper 服务正在运行。"
    else
        echo "Zookeeper 服务未运行。"
    fi
else
    echo "未找到Zookeeper。"
fi

# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; then
    echo "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"
    if ps -ef | grep -v grep | grep spring > /dev/null; then
        echo "Spring Framework 服务可能正在运行。"
    else
        echo "Spring Framework 服务可能未运行。"
    fi
else
    echo "未找到Spring Framework。"
fi

# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; then
    echo "Hibernate 可能已安装。"
    if ps -ef | grep -v grep | grep hibernate > /dev/null; then
        echo "Hibernate 服务可能正在运行。"
    else
        echo "Hibernate 服务可能未运行。"
    fi
else
    echo "未找到Hibernate。"
fi

# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; then
    docker --version
    which docker
    if ps -ef | grep -v grep | grep docker > /dev/null; then
        echo "Docker 服务正在运行。"
    else
        echo "Docker 服务未运行。"
    fi
else
    echo "未找到Docker。"
fi

# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; then
    kubectl version --client
    which kubectl
    if ps -ef | grep -v grep | grep kube > /dev/null; then
        echo "Kubernetes 服务正在运行。"
    else
        echo "Kubernetes 服务未运行。"
    fi
else
    echo "未找到Kubernetes。"
fi

suse15-16

#!/bin/bash

echo "SUSE 15/16 系统软件信息收集"

# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/os-release

# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; then
    java -version
    which java
    if ps -ef | grep -v grep | grep java > /dev/null; then
        echo "JDK 服务正在运行。"
    else
        echo "JDK 服务未运行。"
    fi
else
    echo "未找到JDK。"
fi

# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; then
    httpd -v
    which httpd
    if ps -ef | grep -v grep | grep httpd > /dev/null; then
        echo "Apache HTTP Server 服务正在运行。"
    else
        echo "Apache HTTP Server 服务未运行。"
    fi
else
    echo "未找到Apache HTTP Server。"
fi

# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; then
    nginx -v
    which nginx
    if ps -ef | grep -v grep | grep nginx > /dev/null; then
        echo "NGINX 服务正在运行。"
    else
        echo "NGINX 服务未运行。"
    fi
else
    echo "未找到NGINX。"
fi

# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then
    /srv/tomcat/bin/version.sh
    echo "Tomcat路径:/srv/tomcat"
    if ps -ef | grep -v grep | grep tomcat > /dev/null; then
        echo "Tomcat 服务正在运行。"
    else
        echo "Tomcat 服务未运行。"
    fi
else
    echo "未找到Tomcat。"
fi

# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; then
    redis-server -v
    which redis-server
    if ps -ef | grep -v grep | grep redis-server > /dev/null; then
        echo "Redis 服务正在运行。"
    else
        echo "Redis 服务未运行。"
    fi
else
    echo "未找到Redis。"
fi

# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; then
    echo "Kafka 已安装。"
    which kafka-server-start
    if ps -ef | grep -v grep | grep kafka > /dev/null; then
        echo "Kafka 服务正在运行。"
    else
        echo "Kafka 服务未运行。"
    fi
else
    echo "未找到Kafka。"
fi

# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; then
    rabbitmqctl status
    which rabbitmqctl
    if ps -ef | grep -v grep | grep rabbitmq > /dev/null; then
        echo "RabbitMQ 服务正在运行。"
    else
        echo "RabbitMQ 服务未运行。"
    fi
else
    echo "未找到RabbitMQ。"
fi

# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then
    /opt/activemq/bin/activemq --version
    echo "ActiveMQ路径:/opt/activemq"
    if ps -ef | grep -v grep | grep activemq > /dev/null; then
        echo "ActiveMQ 服务正在运行。"
    else
        echo "ActiveMQ 服务未运行。"
    fi
else
    echo "未找到ActiveMQ。"
fi

# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; then
    zkServer.sh status
    which zkServer.sh
    if ps -ef | grep -v grep | grep zookeeper > /dev/null; then
        echo "Zookeeper 服务正在运行。"
    else
        echo "Zookeeper 服务未运行。"
    fi
else
    echo "未找到Zookeeper。"
fi

# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; then
    echo "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"
    if ps -ef | grep -v grep | grep spring > /dev/null; then
        echo "Spring Framework 服务可能正在运行。"
    else
        echo "Spring Framework 服务可能未运行。"
    fi
else
    echo "未找到Spring Framework。"
fi

# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; then
    echo "Hibernate 可能已安装。"
    if ps -ef | grep -v grep | grep hibernate > /dev/null; then
        echo "Hibernate 服务可能正在运行。"
    else
        echo "Hibernate 服务可能未运行。"
    fi
else
    echo "未找到Hibernate。"
fi

# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; then
    docker --version
    which docker
    if ps -ef | grep -v grep | grep docker > /dev/null; then
        echo "Docker 服务正在运行。"
    else
        echo "Docker 服务未运行。"
    fi
else
    echo "未找到Docker。"
fi

# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; then
    kubectl version --client
    which kubectl
    if ps -ef | grep -v grep | grep kube > /dev/null; then
        echo "Kubernetes 服务正在运行。"
    else
        echo "Kubernetes 服务未运行。"
    fi
else
    echo "未找到Kubernetes。"
fi
相关推荐
鸭梨山大。37 分钟前
Jenkins 任意文件读取(CVE-2024-23897)修复及复现
安全·中间件·jenkins
what_20188 小时前
中间件xxl-job安装
中间件
明月看潮生18 小时前
青少年编程与数学 02-004 Go语言Web编程 10课题、中间件
开发语言·青少年编程·中间件·编程与数学·goweb
小屁不止是运维1 天前
麒麟操作系统服务架构保姆级教程(五)NGINX中间件详解
linux·运维·服务器·nginx·中间件·架构
蜡笔小鑫️2 天前
金碟中间件-AAS-V10.0安装
中间件
Lspecialnx_2 天前
文件解析漏洞中间件(iis和Apache)
网络安全·中间件
隔着天花板看星星2 天前
Spark-Streaming集成Kafka
大数据·分布式·中间件·spark·kafka
Autumn.h3 天前
文件解析漏洞
web安全·网络安全·中间件
武汉联从信息3 天前
Oracle 中间件 Webcenter Portal服务器环境搭建
中间件
小屁不止是运维4 天前
麒麟操作系统服务架构保姆级教程(三)NGINX中间件
linux·运维·服务器·nginx·中间件·架构