Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to detect parent process is killed?

 
jason williams
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a process which spawned a child process performing some tasks. But a problem happens when parent process is killed (by calling e.g. kill <pid>), the child process becomes an orphan. I test to use jps checking if parent process still exists or not, but it doesn't take effect. How would be the right way to check if parent process is killed and stop child process?

Thanks



 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why, under what circumstances, is the parent process being killed?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic