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 time so what i want to do is split get.cgi into 2 programs.
1) Display a message (i.e. The Total count of hits related to the users search term say for example is 2000) and a message stating that "your results are processing".
2) Call background program (back.pl) and display the results simultaneously results should be displayed along with the background programs while processing. For Example let us consider I have three tasks.
Back.pl (background program) has the following tasks. I want the results should be displayed as soon as task 1 is completed and when task 2 is completed and when task3 is completed. The program should not wait to display the results after all the 3 tasks are completed. It should display the results as soon as one task is completed( In this case task1 should be first and so on.
The display can be like this:
Can i do like this in perl?
Any suggestions how can i do this in perl?
How to call a program and run at the background process in per?
I just read few posts on internet they mentioned like use system("perl back.pl &") in Perl. Can i use this and get my desired output?
How can i get the above output in perl or there any other methods in perl ?
I need to run an interactive program in the background so I can grep it for specific data to use for some logic in a script.
There is no quiet or background mode on the program so I plan to redirect a document with commands in it and then to grep the output.
This is almost working, except... (1 Reply)
Hii Friends,
I am using Perl CGI. I am running A SCP Command via Perl CGI in Background. Like
system("scp -r machinename:/PathOfFile/ /Path/WhereToCopyIt/ &)
This Copy Process takes some times lets say 15 min.
Now I want When This copy process gets complete then send me... (5 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 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)
Hi all
i have a unix script reformatter.sh
i have a process whereby this script reformats a file before a perl program is used to update it
i am having a little problem automating the entire process . is there a way whereby i can call the unix script from the perl program ? (12 Replies)
Hi,
in my program i need to run an external program in background.I am aware that there are at least 2 alternatives for this:
1)fork+exec
2)system("program &");
I have read several posts about this,and they all tend to suggest to use fork+exec (and that's what i am doing now).
I have some... (2 Replies)
I've tried this a long time ago and was successful but could not remember how i did it. Tried ctrl+Z and then used bg %
could not figure what i did after to keep it no hangup -
not sure if used nohup -p pid, can u plz help me out if this can be done.
Any help will be appreciated. (12 Replies)
Hello ,
I want to run some shell scripts in my perl script. I need to read the script's name from a file ( this file includes the name of all the scripts) and run the script one by one.. Please let me know how to go ..
Thanks in advance,
Radha (5 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)
I have a question regarding running perl in the current process.
I shall demonstrate with an example.
Look at this.
sh-2.05b$ pwd
/tmp
sh-2.05b$ cat test.sh
#! /bin/sh
cd /etc
sh-2.05b$ ./test.sh
sh-2.05b$ pwd
/tmp
sh-2.05b$ . ./test.sh
sh-2.05b$ pwd
/etc
sh-2.05b$
So... (10 Replies)