Centos 6
#!/bin/bashecho "CentOS 6 系统软件信息收集"# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; thenjava -versionwhich javaif ps -ef | grep -v grep | grep java > /dev/null; thenecho "JDK 服务正在运行。"elseecho "JDK 服务未运行。"fi
elseecho "未找到JDK。"
fi# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; thenhttpd -vwhich httpdif ps -ef | grep -v grep | grep httpd > /dev/null; thenecho "Apache HTTP Server 服务正在运行。"elseecho "Apache HTTP Server 服务未运行。"fi
elseecho "未找到Apache HTTP Server。"
fi# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; thennginx -vwhich nginxif ps -ef | grep -v grep | grep nginx > /dev/null; thenecho "NGINX 服务正在运行。"elseecho "NGINX 服务未运行。"fi
elseecho "未找到NGINX。"
fi# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then/srv/tomcat/bin/version.shecho "Tomcat路径:/srv/tomcat"if ps -ef | grep -v grep | grep tomcat > /dev/null; thenecho "Tomcat 服务正在运行。"elseecho "Tomcat 服务未运行。"fi
elseecho "未找到Tomcat。"
fi# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; thenredis-server -vwhich redis-serverif ps -ef | grep -v grep | grep redis-server > /dev/null; thenecho "Redis 服务正在运行。"elseecho "Redis 服务未运行。"fi
elseecho "未找到Redis。"
fi# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; thenecho "Kafka 已安装。"which kafka-server-startif ps -ef | grep -v grep | grep kafka > /dev/null; thenecho "Kafka 服务正在运行。"elseecho "Kafka 服务未运行。"fi
elseecho "未找到Kafka。"
fi# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; thenrabbitmqctl statuswhich rabbitmqctlif ps -ef | grep -v grep | grep rabbitmq > /dev/null; thenecho "RabbitMQ 服务正在运行。"elseecho "RabbitMQ 服务未运行。"fi
elseecho "未找到RabbitMQ。"
fi# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then/opt/activemq/bin/activemq --versionecho "ActiveMQ路径:/opt/activemq"if ps -ef | grep -v grep | grep activemq > /dev/null; thenecho "ActiveMQ 服务正在运行。"elseecho "ActiveMQ 服务未运行。"fi
elseecho "未找到ActiveMQ。"
fi# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; thenzkServer.sh statuswhich zkServer.shif ps -ef | grep -v grep | grep zookeeper > /dev/null; thenecho "Zookeeper 服务正在运行。"elseecho "Zookeeper 服务未运行。"fi
elseecho "未找到Zookeeper。"
fi# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; thenecho "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"if ps -ef | grep -v grep | grep spring > /dev/null; thenecho "Spring Framework 服务可能正在运行。"elseecho "Spring Framework 服务可能未运行。"fi
elseecho "未找到Spring Framework。"
fi# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; thenecho "Hibernate 可能已安装。"if ps -ef | grep -v grep | grep hibernate > /dev/null; thenecho "Hibernate 服务可能正在运行。"elseecho "Hibernate 服务可能未运行。"fi
elseecho "未找到Hibernate。"
fi# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; thendocker --versionwhich dockerif ps -ef | grep -v grep | grep docker > /dev/null; thenecho "Docker 服务正在运行。"elseecho "Docker 服务未运行。"fi
elseecho "未找到Docker。"
fi# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; thenkubectl version --clientwhich kubectlif ps -ef | grep -v grep | grep kube > /dev/null; thenecho "Kubernetes 服务正在运行。"elseecho "Kubernetes 服务未运行。"fi
elseecho "未找到Kubernetes。"
fi
Centos 7
#!/bin/bashecho "CentOS 7 系统软件信息收集"# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; thenjava -versionwhich javaif ps -ef | grep -v grep | grep java > /dev/null; thenecho "JDK 服务正在运行。"elseecho "JDK 服务未运行。"fi
elseecho "未找到JDK。"
fi# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; thenhttpd -vwhich httpdif ps -ef | grep -v grep | grep httpd > /dev/null; thenecho "Apache HTTP Server 服务正在运行。"elseecho "Apache HTTP Server 服务未运行。"fi
elseecho "未找到Apache HTTP Server。"
fi# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; thennginx -vwhich nginxif ps -ef | grep -v grep | grep nginx > /dev/null; thenecho "NGINX 服务正在运行。"elseecho "NGINX 服务未运行。"fi
elseecho "未找到NGINX。"
fi# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then/srv/tomcat/bin/version.shecho "Tomcat路径:/srv/tomcat"if ps -ef | grep -v grep | grep tomcat > /dev/null; thenecho "Tomcat 服务正在运行。"elseecho "Tomcat 服务未运行。"fi
elseecho "未找到Tomcat。"
fi# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; thenredis-server -vwhich redis-serverif ps -ef | grep -v grep | grep redis-server > /dev/null; thenecho "Redis 服务正在运行。"elseecho "Redis 服务未运行。"fi
elseecho "未找到Redis。"
fi# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; thenecho "Kafka 已安装。"which kafka-server-startif ps -ef | grep -v grep | grep kafka > /dev/null; thenecho "Kafka 服务正在运行。"elseecho "Kafka 服务未运行。"fi
elseecho "未找到Kafka。"
fi# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; thenrabbitmqctl statuswhich rabbitmqctlif ps -ef | grep -v grep | grep rabbitmq > /dev/null; thenecho "RabbitMQ 服务正在运行。"elseecho "RabbitMQ 服务未运行。"fi
elseecho "未找到RabbitMQ。"
fi# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then/opt/activemq/bin/activemq --versionecho "ActiveMQ路径:/opt/activemq"if ps -ef | grep -v grep | grep activemq > /dev/null; thenecho "ActiveMQ 服务正在运行。"elseecho "ActiveMQ 服务未运行。"fi
elseecho "未找到ActiveMQ。"
fi# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; thenzkServer.sh statuswhich zkServer.shif ps -ef | grep -v grep | grep zookeeper > /dev/null; thenecho "Zookeeper 服务正在运行。"elseecho "Zookeeper 服务未运行。"fi
elseecho "未找到Zookeeper。"
fi# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; thenecho "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"if ps -ef | grep -v grep | grep spring > /dev/null; thenecho "Spring Framework 服务可能正在运行。"elseecho "Spring Framework 服务可能未运行。"fi
elseecho "未找到Spring Framework。"
fi# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; thenecho "Hibernate 可能已安装。"if ps -ef | grep -v grep | grep hibernate > /dev/null; thenecho "Hibernate 服务可能正在运行。"elseecho "Hibernate 服务可能未运行。"fi
elseecho "未找到Hibernate。"
fi# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; thendocker --versionwhich dockerif ps -ef | grep -v grep | grep docker > /dev/null; thenecho "Docker 服务正在运行。"elseecho "Docker 服务未运行。"fi
elseecho "未找到Docker。"
fi# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; thenkubectl version --clientwhich kubectlif ps -ef | grep -v grep | grep kube > /dev/null; thenecho "Kubernetes 服务正在运行。"elseecho "Kubernetes 服务未运行。"fi
elseecho "未找到Kubernetes。"
fi
Rocky 8
#!/bin/bashecho "Rocky Linux 8 系统软件信息收集"# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/redhat-release# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; thenjava -versionwhich javaif ps -ef | grep -v grep | grep java > /dev/null; thenecho "JDK 服务正在运行。"elseecho "JDK 服务未运行。"fi
elseecho "未找到JDK。"
fi# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; thenhttpd -vwhich httpdif ps -ef | grep -v grep | grep httpd > /dev/null; thenecho "Apache HTTP Server 服务正在运行。"elseecho "Apache HTTP Server 服务未运行。"fi
elseecho "未找到Apache HTTP Server。"
fi# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; thennginx -vwhich nginxif ps -ef | grep -v grep | grep nginx > /dev/null; thenecho "NGINX 服务正在运行。"elseecho "NGINX 服务未运行。"fi
elseecho "未找到NGINX。"
fi# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then/srv/tomcat/bin/version.shecho "Tomcat路径:/srv/tomcat"if ps -ef | grep -v grep | grep tomcat > /dev/null; thenecho "Tomcat 服务正在运行。"elseecho "Tomcat 服务未运行。"fi
elseecho "未找到Tomcat。"
fi# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; thenredis-server -vwhich redis-serverif ps -ef | grep -v grep | grep redis-server > /dev/null; thenecho "Redis 服务正在运行。"elseecho "Redis 服务未运行。"fi
elseecho "未找到Redis。"
fi# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; thenecho "Kafka 已安装。"which kafka-server-startif ps -ef | grep -v grep | grep kafka > /dev/null; thenecho "Kafka 服务正在运行。"elseecho "Kafka 服务未运行。"fi
elseecho "未找到Kafka。"
fi# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; thenrabbitmqctl statuswhich rabbitmqctlif ps -ef | grep -v grep | grep rabbitmq > /dev/null; thenecho "RabbitMQ 服务正在运行。"elseecho "RabbitMQ 服务未运行。"fi
elseecho "未找到RabbitMQ。"
fi# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then/opt/activemq/bin/activemq --versionecho "ActiveMQ路径:/opt/activemq"if ps -ef | grep -v grep | grep activemq > /dev/null; thenecho "ActiveMQ 服务正在运行。"elseecho "ActiveMQ 服务未运行。"fi
elseecho "未找到ActiveMQ。"
fi# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; thenzkServer.sh statuswhich zkServer.shif ps -ef | grep -v grep | grep zookeeper > /dev/null; thenecho "Zookeeper 服务正在运行。"elseecho "Zookeeper 服务未运行。"fi
elseecho "未找到Zookeeper。"
fi# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; thenecho "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"if ps -ef | grep -v grep | grep spring > /dev/null; thenecho "Spring Framework 服务可能正在运行。"elseecho "Spring Framework 服务可能未运行。"fi
elseecho "未找到Spring Framework。"
fi# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; thenecho "Hibernate 可能已安装。"if ps -ef | grep -v grep | grep hibernate > /dev/null; thenecho "Hibernate 服务可能正在运行。"elseecho "Hibernate 服务可能未运行。"fi
elseecho "未找到Hibernate。"
fi# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; thendocker --versionwhich dockerif ps -ef | grep -v grep | grep docker > /dev/null; thenecho "Docker 服务正在运行。"elseecho "Docker 服务未运行。"fi
elseecho "未找到Docker。"
fi# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; thenkubectl version --clientwhich kubectlif ps -ef | grep -v grep | grep kube > /dev/null; thenecho "Kubernetes 服务正在运行。"elseecho "Kubernetes 服务未运行。"fi
elseecho "未找到Kubernetes。"
fi
suse15-16
#!/bin/bashecho "SUSE 15/16 系统软件信息收集"# 检查操作系统版本
echo "操作系统版本信息:"
cat /etc/os-release# 检查JDK
echo "检查JDK版本..."
if command -v java &> /dev/null; thenjava -versionwhich javaif ps -ef | grep -v grep | grep java > /dev/null; thenecho "JDK 服务正在运行。"elseecho "JDK 服务未运行。"fi
elseecho "未找到JDK。"
fi# 检查Apache HTTP Server
echo "检查Apache HTTP Server..."
if command -v httpd &> /dev/null; thenhttpd -vwhich httpdif ps -ef | grep -v grep | grep httpd > /dev/null; thenecho "Apache HTTP Server 服务正在运行。"elseecho "Apache HTTP Server 服务未运行。"fi
elseecho "未找到Apache HTTP Server。"
fi# 检查NGINX
echo "检查NGINX..."
if command -v nginx &> /dev/null; thennginx -vwhich nginxif ps -ef | grep -v grep | grep nginx > /dev/null; thenecho "NGINX 服务正在运行。"elseecho "NGINX 服务未运行。"fi
elseecho "未找到NGINX。"
fi# 检查Tomcat
echo "检查Tomcat..."
if [ -d "/srv/tomcat" ]; then/srv/tomcat/bin/version.shecho "Tomcat路径:/srv/tomcat"if ps -ef | grep -v grep | grep tomcat > /dev/null; thenecho "Tomcat 服务正在运行。"elseecho "Tomcat 服务未运行。"fi
elseecho "未找到Tomcat。"
fi# 检查Redis
echo "检查Redis..."
if command -v redis-server &> /dev/null; thenredis-server -vwhich redis-serverif ps -ef | grep -v grep | grep redis-server > /dev/null; thenecho "Redis 服务正在运行。"elseecho "Redis 服务未运行。"fi
elseecho "未找到Redis。"
fi# 检查Kafka
echo "检查Kafka..."
if command -v kafka-server-start &> /dev/null; thenecho "Kafka 已安装。"which kafka-server-startif ps -ef | grep -v grep | grep kafka > /dev/null; thenecho "Kafka 服务正在运行。"elseecho "Kafka 服务未运行。"fi
elseecho "未找到Kafka。"
fi# 检查RabbitMQ
echo "检查RabbitMQ..."
if command -v rabbitmqctl &> /dev/null; thenrabbitmqctl statuswhich rabbitmqctlif ps -ef | grep -v grep | grep rabbitmq > /dev/null; thenecho "RabbitMQ 服务正在运行。"elseecho "RabbitMQ 服务未运行。"fi
elseecho "未找到RabbitMQ。"
fi# 检查ActiveMQ
echo "检查ActiveMQ..."
if [ -d "/opt/activemq" ]; then/opt/activemq/bin/activemq --versionecho "ActiveMQ路径:/opt/activemq"if ps -ef | grep -v grep | grep activemq > /dev/null; thenecho "ActiveMQ 服务正在运行。"elseecho "ActiveMQ 服务未运行。"fi
elseecho "未找到ActiveMQ。"
fi# 检查Zookeeper
echo "检查Zookeeper..."
if command -v zkServer.sh &> /dev/null; thenzkServer.sh statuswhich zkServer.shif ps -ef | grep -v grep | grep zookeeper > /dev/null; thenecho "Zookeeper 服务正在运行。"elseecho "Zookeeper 服务未运行。"fi
elseecho "未找到Zookeeper。"
fi# 检查Spring Framework
echo "检查Spring Framework..."
if [ -f "/path/to/your/spring/app/pom.xml" ] || [ -f "/path/to/your/spring/app/build.gradle" ]; thenecho "Spring Framework 可能已安装,请检查应用项目中的依赖文件。"if ps -ef | grep -v grep | grep spring > /dev/null; thenecho "Spring Framework 服务可能正在运行。"elseecho "Spring Framework 服务可能未运行。"fi
elseecho "未找到Spring Framework。"
fi# 检查Hibernate
echo "检查Hibernate..."
if grep -q "hibernate" "/path/to/your/project/pom.xml"; thenecho "Hibernate 可能已安装。"if ps -ef | grep -v grep | grep hibernate > /dev/null; thenecho "Hibernate 服务可能正在运行。"elseecho "Hibernate 服务可能未运行。"fi
elseecho "未找到Hibernate。"
fi# 检查Docker
echo "检查Docker..."
if command -v docker &> /dev/null; thendocker --versionwhich dockerif ps -ef | grep -v grep | grep docker > /dev/null; thenecho "Docker 服务正在运行。"elseecho "Docker 服务未运行。"fi
elseecho "未找到Docker。"
fi# 检查Kubernetes
echo "检查Kubernetes..."
if command -v kubectl &> /dev/null; thenkubectl version --clientwhich kubectlif ps -ef | grep -v grep | grep kube > /dev/null; thenecho "Kubernetes 服务正在运行。"elseecho "Kubernetes 服务未运行。"fi
elseecho "未找到Kubernetes。"
fi