aspose file tools*
The moose likes Linux / UNIX and the fly likes Equivalent kill -n for process.destroy() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Equivalent kill -n for process.destroy()" Watch "Equivalent kill -n for process.destroy()" New topic
Author

Equivalent kill -n for process.destroy()

E Hill
Greenhorn

Joined: Aug 11, 2009
Posts: 7
Hi

I am trying to emulate the functionality of a currently existing Java application, here applications and .jars run by creating a process and they are shutdown by process.destroy().

My problem is that the process that will be doing the killing will be run from the command line, or a separate java program, so the only method of killing the process is to find the PID from ps and then use the linux kill command to kill the processes. So what is the equivalent flag in kill to the process.destroy()?

Thanks
E. Hill
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

E, welcome to Java Ranch!

I use -9 to make sure the process gets killed. Example to kill proccess with pid of 1234:

kill -9 1234


JBoss In Action
E Hill
Greenhorn

Joined: Aug 11, 2009
Posts: 7
Hi

Thanks for the reply, does java use the equivalent of -9 in its process destroy? Killing everything with no chance of running and cleanup scripts etc?

We have the example of Process.destroy() in the program source code, however we are unable to kill the processes from Java as we will be launching through the command line and will not be starting processes in Java. We dont want to be too heavy-handed if possible, so would prefer to only use -9 as a last resort.

Thanks
E.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Equivalent kill -n for process.destroy()