Connecting Tech Pros Worldwide Forums | Help | Site Map

[Off Topic] Web Application need to call a perl program.

Newbie
 
Join Date: Feb 2007
Posts: 8
#1: Feb 9 '07
Hi,

I would like to know how can I make a daemon program in perl,say DP . The said program need to call a a program say A, which will to parse huge text file. The run time of A may vary say 5 to 6 hrs on average. There will be a lot of execution request reach the daemon program(DP) parsing different text files. so I need this daemon program to schedule each request in proper interval of time.

I need to call the program from a web interface. so that the DP will take the request from the web interface and invoke it.Since the web user cant wait for long time online, could any body tell me a idea how a perl program can survive in this scenario.

Regards
Shyam

KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Feb 9 '07

re: [Off Topic] Web Application need to call a perl program.


instead of a deamon, maybe cron or task would be more appropriate. People make a request, which is stored in a file or database. The cron/task starts and reads the request file/database and starts the jobs at a convenient time for the server. From there I'm not sure. Write the results to files ID'ed by the user requests or something similar so they can come back later and read the results.
docsnyder's Avatar
Member
 
Join Date: Dec 2006
Location: Darmstadt
Posts: 88
#3: Feb 12 '07

re: [Off Topic] Web Application need to call a perl program.


@shyamkumars

If you want to tell your daemon about a new task, your web interface should invoke a cgi-script, when the submit button is hit. This cgi-script should, however (e.g. interprocess communication via shared memory, signals, files), communicate with your daemon DP, telling him about the new job.

Forget about to introduce a cron job, because this does not solve your problem to trigger requests "on demand" via the web interface. Your approach, using a daemon, is appropriate!

Greetz, Doc
Newbie
 
Join Date: Feb 2007
Posts: 8
#4: Feb 12 '07

re: [Off Topic] Web Application need to call a perl program.


Hi,

Thanks KevinADC and docsnyder for your valid suggestions.

I think the cron job scenerio will not work for me. Since it is a web application. The "Work" have to start from the moment when any one of the user click the submit button. But I think the the search parameter and the file details can be stored in the database itself, which is identified by a suitable user id.

Just assume the case. There is a max of 6 of parsing per day in a sequential order. I will make use of database field value as some status flag to make use of it say.But I need to restrict the number of execution request. How can I get the details how much process is running in this daemon.

Thanks In advance.
Regards
Shyam
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#5: Feb 12 '07

re: [Off Topic] Web Application need to call a perl program.


if the work has to start immeadiatly then cron/task is not appropriate. But it seems that it's a good possibility to consider since the process takes so long to complete. The jobs could still be run in order of request as a cron/task and load taken off the server if they run during off-peak hours (if there are any off-peak hours). But anyways, thats just a general thought and something to keep in mind in case you ever need to do something like that.

Maybe doc can answer the last part of your question, it's a bit out of my range of experience and I don't need another tounge lashing from him so soon. ;)
Reply