This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Signal Handling

 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java process that is started in background by a shell script. The script writes the PID of the process to a file, and later, a stop script can read the file and kill the process. When I start the process inside an xterm window, I find that the process dies when the window is closed. This happens only with xterm, and other shells dont seem to kill the process when they exit. I have some workarounds that involve modifying the shell script, but I need to do some kind of signal handling in the java code. Can any one tell me if it is possible to write a piece of java code, that makes sure the hangup signal is ignored.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about simply using "nohup" to start the java process?
- Peter
 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep I did that. and it works. But then, the requirement is to modify the java code itself to take care of the signal. Thats the problem!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to check out this article Revelations on Java signal handling and termination.
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic