The simple way is not to involve the shell and launch your background process via open. Then you can kill your child at program end through kill:
my $kid = open(my $fh, "launch_java.sh |") or die "Couldn't launch 'launch_java.sh': $! / $?"; END { if ($kid) { kill 9 => $kid; # bang }; };
See perlipc for other methods.
In reply to Re: how to kill background process when script exit?
by Corion
in thread how to kill background process when script exit?
by Allasso
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |