Do you want to do any additional processing while the file is being transferred? If not, I don't see why the transfer process should be separated from the main process.
Otherwise, here's a small script on how to use fork:
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)
Hi,
Thanks in advance.
i need to kill a unix background running job after that job process completes.
i can kill a job by giving the following unix command
kill -9 processid
how to kill the job after the current process run gets completed ?
Appreciate your valuable help.
... (1 Reply)
Hi,
Thanks in advance.
i need to kill a unix background running job after that job process completes.
i can kill a job by giving the following unix command
kill -9 processid
how to kill the job after the current process run gets completed ?
Appreciate your valuable help.
Thanks... (7 Replies)
I have a perl process I want to run in background in a cgi, but do not
want to continue until process finished code looks like this.
sub calc(){
do calculations
return value
}
In another Perl program I call above function such as
&calc();
I want to continue after process... (4 Replies)
Hi
When I run ./script.sh &
the script runs in bg
But when I close the telnet session, the script is killed also.
any idea how to keep this script running?
thx (4 Replies)
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)
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)
Hi, guys:
I am working on my own shell using c. When I put a process into the background, how can I put it back to the foreground using tcsetpgrp?
Thanks (3 Replies)
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)
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
LEARN ABOUT PHP
pcntl_waitpid
PCNTL_WAITPID(3) 1 PCNTL_WAITPID(3)pcntl_waitpid - Waits on or returns the status of a forked childSYNOPSIS
int pcntl_waitpid (int $pid, int &$status, [int $options])
DESCRIPTION
Suspends execution of the current process until a child as specified by the $pid argument has exited, or until a signal is delivered whose
action is to terminate the current process or to call a signal handling function.
If a child as requested by $pid has already exited by the time of the call (a so-called "zombie" process), the function returns immedi-
ately. Any system resources used by the child are freed. Please see your system's waitpid(2) man page for specific details as to how wait-
pid works on your system.
PARAMETERS
o $pid
- The value of $pid can be one of the following:
possible values for $pid
+-----+---------------------------------------------------+
| | |
|< -1 | |
| | |
| | wait for any child process whose process group |
| | ID is equal to the absolute value of $pid. |
| | |
| | |
| -1 | |
| | |
| | wait for any child process; this is the same be- |
| | haviour that the wait function exhibits. |
| | |
| | |
| 0 | |
| | |
| | wait for any child process whose process group |
| | ID is equal to that of the calling process. |
| | |
| | |
|> 0 | |
| | |
| | wait for the child whose process ID is equal to |
| | the value of $pid. |
| | |
+-----+---------------------------------------------------+
Note
Specifying -1 as the $pid is equivalent to the functionality pcntl_wait(3) provides (minus $options).
o $status
-pcntl_waitpid(3) will store status information in the $status parameter which can be evaluated using the following functions:
pcntl_wifexited(3), pcntl_wifstopped(3), pcntl_wifsignaled(3), pcntl_wexitstatus(3), pcntl_wtermsig(3) and pcntl_wstopsig(3).
o $options
- The value of $options is the value of zero or more of the following two global constants OR'ed together:
possible values for $options
+----------+---------------------------------------------------+
| | |
| WNOHANG | |
| | |
| | return immediately if no child has exited. |
| | |
| | |
|WUNTRACED | |
| | |
| | return for children which are stopped, and whose |
| | status has not been reported. |
| | |
+----------+---------------------------------------------------+
RETURN VALUES pcntl_waitpid(3) returns the process ID of the child which exited, -1 on error or zero if WNOHANG was used and no child was available
SEE ALSO pcntl_fork(3), pcntl_signal(3), pcntl_wifexited(3), pcntl_wifstopped(3), pcntl_wifsignaled(3), pcntl_wexitstatus(3), pcntl_wtermsig(3),
pcntl_wstopsig(3).
PHP Documentation Group PCNTL_WAITPID(3)