Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of SHELL script Monitoring JAVA process

Shulou Source: shulou.com Published: 2022-06-03 18:36:46 11月12日 Update

This article mainly shows you the "SHELL script monitoring JAVA process example analysis", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "SHELL script monitoring JAVA process example analysis" this article.

Content of the script: java_check.sh

#! / bin/bash # if [- z `pidof java`]; then echo-e `java` +% Ymuri% mmury% d``date +% R`. "33 [31m33 [1m (JAVA) Process does not exist! 33 [0m" > > / data/logs/java_check.log / usr/local/tomcat/bin/startup.sh > / dev/null 2 > & 1 sleep 30 netstat-tnlp > > / data/logs/java_check.log echo-e "r" > > / data/logs/java_check.log fi

Plan the mission and execute it every 15 minutes.

The code is as follows:

* / 15 * root / usr/local/bin/java_check.sh

A shell that monitors the running of java programs

#! / bin/shexport Jacks Lib grep grep data java XinTai export CLASSPATH=.:$J_LIB/jtds-1.2.jar:$J_LIB/log4j-1.2.12.jar:$J_LIB/postgresql-8.1-404.jdbc3.jarterexport java XinTai / bin/ps ax | / bin/grep-v java XinTai | / bin/grep "java XinTai"; export Else cd / data/sms/xintai; / usr/java/jdk1.5.0_05/bin/java XinTai > / dev/null & fi

Regular execution ensures that java XinTai can run all the time.

The above is all the contents of the article "sample Analysis of SHELL script Monitoring JAVA process". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Scripts monitoring content examples processes analysis articles learning help running code tasks easy to understand more organization knowledge programs editing industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Shulou Tech Info Apple Linux