Sponsored Content
Top Forums Shell Programming and Scripting Perl Background Process - Finshed Yet? Post 302148975 by photon on Tuesday 4th of December 2007 12:30:20 PM
Old 12-04-2007
Its funny none of the perl books I have had anything on waitpid. I had to go to the Stevens book, but waitpid is the solution I came up with too.
.
Code:
defined(my $pid = fork()) or die "Cannot fork: $!";
if($pid){
    ## waitpid($pid, 0);
    ## or if you want the pid
    do{
        $kid = waitpid(-1, WNOHANG);
        $count_pid = $kid;
    }until $kid > 0;

    $out .= qq|<hidden type="count_pid" value="$count_pid">|;
    ## javascript redirect here
}else{
    &calc();
    CORE::exit(0);
}

It works good, but still looking for a way to improve. I may have to use AJAX or something to get rid of reloads.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

capture the process id when starting a background process

Hello all, How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename. Any assistance is most appreciated. Thanks, Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies

2. UNIX for Dummies Questions & Answers

background process

How, can I hide background process's output? (5 Replies)
Discussion started by: zylwyz
5 Replies

3. Shell Programming and Scripting

background process

can anybody plz tell me how can i find the background processes running. (2 Replies)
Discussion started by: Raom
2 Replies

4. Shell Programming and Scripting

background process

i gave a copy process in the background( to copy around 100GB) , while in progress, the session got terminated. when i relogged in and checked the destination folder the copying was in progress... how could it happen(copying) when the shell terminates??? :rolleyes: (2 Replies)
Discussion started by: vinod.thayil
2 Replies

5. Shell Programming and Scripting

How to process and run a program in the background in perl?

Hi, I have a query about processing and running Perl program at the background. I have HTML file called Userform.html which accepts input from the user. As soon as input is given the contol goes to get.cgi (get.cgi does some processing and computing tasks). Actually get .cgi takes more... (0 Replies)
Discussion started by: vanitham
0 Replies

6. UNIX for Dummies Questions & Answers

Background Process

I need to submit a script that will continue to run after logging out and after a reboot or shutdown. I entered the following: nohup script & The script continues to run in the background after logging off the system but is killed after a reboot or shutdown. Any help would be greatly... (1 Reply)
Discussion started by: powwm
1 Replies

7. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

8. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

9. Shell Programming and Scripting

How to call a background process in perl?

Hi, I want to put the following code as a parallel or background process The program is as below: $n=10; #Count of files to be created. for($j=0;$j<=$n;$j++) { open(FH,">files_$j.txt") || warn "cannot create a file\n"; { print FH "count of file: $j\n"; #Sample data to be written. just... (5 Replies)
Discussion started by: vanitham
5 Replies

10. Shell Programming and Scripting

Make background process interact with fg process

Hi, I have written a menu driven shell script in which as per the choice, I run the another script on background. For eg: 1. get info 2)process info 3)modify info All the operations have different scripts which i schedule in background using &. However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies
PERLVMESA(1)						 Perl Programmers Reference Guide					      PERLVMESA(1)

NAME
README.vmesa - building and installing Perl for VM/ESA. SYNOPSIS
This document will help you Configure, build, test and install Perl on VM/ESA. DESCRIPTION
This is a fully ported perl for VM/ESA 2.3.0. It may work on other versions, but that's the one we've tested it on. If you've downloaded the binary distribution, it needs to be installed below /usr/local. Source code distributions have an automated "make install" step that means you do not need to extract the source code below /usr/local (though that is where it will be installed by default). You may need to worry about the networking configuration files discussed in the last bullet below. Unpacking Perl Distribution on VM/ESA To extract an ASCII tar archive on VM/ESA, try this: pax -o to=IBM-1047,from=ISO8859-1 -r < latest.tar Setup Perl and utilities on VM/ESA GNU make for VM/ESA, which may be required for the build of perl, is available from: <http://vm.marist.edu/~neale/vmoe.html> Configure Perl on VM/ESA Once you've unpacked the distribution, run Configure (see INSTALL for full discussion of the Configure options), and then run make, then "make test" then "make install" (this last step may require UID=0 privileges). There is a "hints" file for vmesa that specifies the correct values for most things. Some things to watch out for are: o this port does support dynamic loading but it's not had much testing o Don't turn on the compiler optimization flag "-O". There's a bug in the compiler (APAR PQ18812) that generates some bad code the optimizer is on. o As VM/ESA doesn't fully support the fork() API programs relying on this call will not work. I've replaced fork()/exec() with spawn() and the standalone exec() with spawn(). This has a side effect when opening unnamed pipes in a shell script: there is no child process generated under. o At the moment the hints file for VM/ESA basically bypasses all of the automatic configuration process. This is because Configure relies on: 1. The header files living in the Byte File System (you could put the there if you want); 2. The C preprocessor including the #include statements in the preprocessor output (.i) file. Testing Anomalies of Perl on VM/ESA The "make test" step runs a Perl Verification Procedure, usually before installation. As the 5.6.1 kit was being assembled the following "failures" were known to appear on some machines during "make test" (mostly due to ASCII vs. EBCDIC conflicts), your results may differ: [the list of failures being compiled] Usage Hints for Perl on VM/ESA When using perl on VM/ESA please keep in mind that the EBCDIC and ASCII character sets are different. Perl builtin functions that may behave differently under EBCDIC are mentioned in the perlport.pod document. OpenEdition (UNIX System Services) does not (yet) support the #! means of script invocation. See: head `whence perldoc` for an example of how to use the "eval exec" trick to ask the shell to have perl run your scripts for you. AUTHORS
Neale Ferguson. SEE ALSO
INSTALL, perlport, perlebcdic. Mailing list for Perl on VM/ESA If you are interested in the VM/ESA, z/OS (formerly known as OS/390) and POSIX-BC (BS2000) ports of Perl then see the perl-mvs mailing list. To subscribe, send an empty message to perl-mvs-subscribe@perl.org. See also: http://lists.perl.org/showlist.cgi?name=perl-mvs <http://lists.perl.org/showlist.cgi?name=perl-mvs> There are web archives of the mailing list at: o http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/ <http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/> o http://archive.develooper.com/perl-mvs@perl.org/ <http://archive.develooper.com/perl-mvs@perl.org/> perl v5.14.2 2011-09-26 PERLVMESA(1)
All times are GMT -4. The time now is 10:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy