• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

handling Java child process execution

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic