Am I missing a big pink elephant here?
that does not seem to launch the process in the background though. I want to launch the java app, then continue on with my script (also, the pid isn't returned until I quit the java app - not real helpful). It seems that an '&' is necessary here, no?
But anyway, I had already tried other things using open() as well, but I couldn't get them to work:
$kid = open (FH, "java JavaApp | &"); print $kid;
(gives "no such file or directory" message, $kid not returned until java app is quit)
$kid = open (FH, "java JavaApp & |"); print $kid;
(causes my script to hang, $kid not returned at all)
for some reason, if I redirect the stderr to /dev/null:
$kid = open (FH, "java JavaApp 2> /dev/null & |"); print $kid;
the app DOES run in the background, $kid is returned immediately, HOWEVER, the app doesn't quit when I end the script. If I take the number returned in $kid (eg, 1001), and manually try to kill the process with it I get:
kill 1001 -bash: kill: (1001) - No such process
Also tried:
`java JavaApp &`(gives "no such file or directory" message)
??????
I have found lots of stuff on the net on how to start a background process in perl, but nothing on how to kill one (in a perl script).
In reply to Re^2: how to kill background process when script exit?
by Allasso
in thread how to kill background process when script exit?
by Allasso
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |