0

In Groovy, is there a way to check if the program is still running by using the PID?

2 Answers2

1

You can use kill command with 0 signal. Sample code in Groovy:

"kill -0 ${pid}".execute().waitFor()

0 as a returned value means the process is still running.

Community
  • 1
  • 1
Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
0

yes there is a way to check if the program running ,To check for the existence of a process, use

kill -0 $PID
Ferrakkem Bhuiyan
  • 2,741
  • 2
  • 22
  • 38