Marmeladov
Programmer
Hi, i'm quite (read very) new to perl, but need to get a script running that starts an application but can't get i to function properly. I don't recieve any errors, but the scipt seems to be asleep, waiting for a parent process id... unfortunately i haven't got the script on this machine right now, but i'll try to decsribe it anyway...
@ports=qw(3333 2444 etc.)
for $port (@ports) {
unless(fork){
unless(fork){
sleep 1 until getppid==1;
'and this is where the application details goes
'/usr/bla/bla/appstart - port=$port and some parameters
exit 0;
}
exit 0;
}
wait;
}
I might have missed out on some details, but this is the general plot. when i run this (perl script.pl), i get returned to the bash and a process check shows the script.pl as running. however, removing the line "sleep 1..." starts the application as intended. What does this "sleep" thing wait for (i know it is parent process id, but it does not seem to get that...). any tips or solutions?? really need this to function
/Marmeladov
@ports=qw(3333 2444 etc.)
for $port (@ports) {
unless(fork){
unless(fork){
sleep 1 until getppid==1;
'and this is where the application details goes
'/usr/bla/bla/appstart - port=$port and some parameters
exit 0;
}
exit 0;
}
wait;
}
I might have missed out on some details, but this is the general plot. when i run this (perl script.pl), i get returned to the bash and a process check shows the script.pl as running. however, removing the line "sleep 1..." starts the application as intended. What does this "sleep" thing wait for (i know it is parent process id, but it does not seem to get that...). any tips or solutions?? really need this to function
/Marmeladov