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
相关推荐
谷大羽1 天前
Kafka Stream实战教程
spring boot·后端·中间件·kafka·stream
隔着天花板看星星2 天前
Kafka-创建topic源码
大数据·分布式·中间件·kafka
get2002 天前
Gin 框架中间件详细介绍
中间件·gin
一水鉴天2 天前
智能工厂的设计软件 为了监管控一体化的全能Supervisor 的监督学习 之 序5 架构for认知系统 总述 (架构全图)
人工智能·学习·中间件·架构
谢尔登3 天前
【Next】中间件
服务器·javascript·中间件
极客先躯3 天前
高级java每日一道面试题-2024年11月09日-缓存中间件篇-Redis和Memecache有什么区别?
java·缓存·中间件·每日一道面试题·高级java·缓存中间件篇
隔着天花板看星星3 天前
Kafka-Controller角色需要做什么?
大数据·分布式·中间件·kafka
留乘船3 天前
使用gin -gorm-jwt-中间件拦截的一个小项目
开发语言·学习·中间件·golang·gin
Amd7945 天前
Nuxt.js 应用中的 vite:serverCreated 事件钩子
中间件·开发·vite·日志·nuxt·跨域·钩子
0x派大星6 天前
【Goland】——Gin 框架中间件详解:从基础到实战
开发语言·后端·中间件·golang·go·gin