chidori has asked for the wisdom of the Perl Monks concerning the following question:

Hi ,

I am in need of calling a perl script from a cgi page. And I don't know how to start this as I have lot of questions on my mind for which I don't have answer.

I guess relying on system command won't be enough here as I have to trigger the script and capture its output in some log.

Also after the script is triggered i am planning to make the page auto refresh and share real time status of the script for which i need to track the script in someway and I don't know how to it.

Can someone please help me on this ?

  • Comment on How to run a perl script from a cgi page and track its status ?

Replies are listed 'Best First'.
Re: How to run a perl script from a cgi page and track its status ?
by Anonymous Monk on Sep 17, 2014 at 15:35 UTC

      Ok , I am planning to go with system command , will send the command to background and also redirect the the output to log like shown below.

      system(myscript >myoutput.log 2>&1 &)

      This way , I am able to send it to background and it does seems to be running. I am planning to use ps -ef | grep myoutput.log to grep the pid and then search for the pid at regular interval to trace its status. Can someone out there let me know if this sounds logical or possibly suggest me a better way please.