Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

handling Java child process execution

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am executing a shell script using java program on unix platform.
I am using Runtime.exec(shell_script_name) method to execute it.
A shell script uses prstat command & it gives well formated output to my java program.
But, the problem is that the prstat command doesn't get killed by unix os.
so that , when ever I execute the script each time a new instance of prstat is seen as a new process using ps -fu command. & this prstat process seen even when java program is stopped.

please, help me so that prstat command execution should get stopped just after script execution finished.

Thanks

Amit Pandit
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your shell script launch "prstat" in the background?

If not, have you tried to invoke Process.destroy() after you've got necessary outout?
 
Vilmantas Baranauskas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW, what happens if you invoke the same shell script manually?
 
amit pandit
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have tried with destory() but id doen't help.

When i run script manually it runs fine. and prstat command (process) is not seen after execution of script.

Thanks

Amit Pandit
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!