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