I am using a perl script to fire off a jar that needs to stay running. However, I want my perl process to end. I thought this thread would solve my problems: How can I fire and forget a process in Perl?
However, I have tried both forking and using the system(cmd &) techniques and in both my perl script stays running.
Here was my code to fork:
if (index($all_jars, 'myjar.jar') == -1) {
unless(fork) {
}
else {
exec("java -jar myjar.jar");
}
}
Here was my code for the system(cmd &): I wasn't sure if this meant to type cmd & my command or just my command & but both systems didn't quit the perl script until after the jar process died.
system("cmd & java -jar myjar.jar");
OR
system("java -jar myjar.jar &");
Not sure what I am doing wrong... Thanks for any help or ideas you could give me.