Home > Java > javaTutorial > body text

Introduction to methods of starting and stopping Java processes in batches (with examples)

不言
Release: 2019-03-12 16:00:28
forward
3203 people have browsed it

This article brings you an introduction to the method of starting and stopping Java processes in batches (with examples). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

java process management program Name: jmanager

Main functions: save all Java process information on the current host, stop Java processes, start Java processes

Problems solved:
The company's current test environment only has a few virtual machines and no container management. The system adopts a distributed architecture and requires many programs to be deployed.
Once the virtual machine restarts or fails, it is very time-consuming and troublesome to use Jenkins to restart the packaging and deployment, so I wrote this script to regularly capture the Java process startup information.
Once a failure occurs, you can stop the Java process in batches or batch Start the Java process.

Applicable environment: Linux system and python3 has been installed, you can execute the jps command

How to install:

git clone https://github.com/mudiyouyou/jmanager.git
Copy after login

Install the following python library

pip3 install json

pip3 install psutil
Copy after login

How to do it because of the network It is recommended to use the following command

pip3 install json -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

pip3 install psutil -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Copy after login

How to operate:

python3 main.py log 解释:记录当前所有java进程信息,产生以当前日志命名的进程数据文件

python3 main.py stop xxxx.json 解释:关闭所有Java进程 xxxx.json 为第一步产生的数据文件

python3 main.py start xxxx.json 解释:启动所有Java进程 xxxx.json 为第一步产生的数据文件
Copy after login

This script is suitable for all java programs and can be installed in other environments, but this script is not responsible for the program startup or stop sequence

The above is the detailed content of Introduction to methods of starting and stopping Java processes in batches (with examples). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template