Write a shell script and bat script that kills Gradle daemon

Source: Internet
Author: User

1. Gradle Daemon is also the Gradle daemon

Gradle needs to run in a Java virtual machine, each execution of the Gradle command means that a new Java Virtual machine is started, loads Gradle classes and libraries, and finally executes the build. In this way, building up will take a lot of time to start and shut down the Java virtual machine.

With the Gradle daemon, you only need to start a Java virtual machine and then reuse it without restarting the Java Virtual machine again. This achieves the goal of shortening the build time.

2. Java virtual machine, each of the existence of a main function will create a new JVM, that is, a machine can create a number of JVMs

Attach the Great God Note

3. Build a script file that ends in. SH, as follows

#!/bin/bashecho "Kill Gradle Daemon" pid= ' JPS | grep Gradledaemon | awk ' {print '} ' kill-9 $pid
#!/bin/bash script Default Start
Echo control is displayed in the console
pid= "Assigning values to variables
JPS lists all the JVM processes, grep Gradledaemon filters out the Gradledaemon process, and awk ' {print '} ' prints out the PID
Kill-9 $pid Kill Process
Note that since there is a collection in the PID, there is no need to write a for loop if there are multiple Gradledaemon processes

Paste the following. bat script
@echo off echo ------------------------------------------echo  Liferay Kill all Gradle Daemon Process Kit  echo ------------------------------------------ for in ('calljps^| find/i "Gradledaemon"'doecho %%i && taskkill/f/pid%%i)

In addition, someone may go to the PS command to find the process, because Gradle is the JVM process, so it is more convenient to use JPS.

Write a shell script and bat script that kills Gradle daemon

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.