develooper Front page | perl.beginners | Postings from February 2009

Forked script doesnt exec from a cgi script

Thread Next
Neetee Pawa
February 8, 2009 00:47
Forked script doesnt exec from a cgi script
Message ID:
Hi All,

I am trying to invoke a perl script in background  from a cgi script. Code 
seems working as i can see the script gets invoked however nothing gets 
executed from the script. ( the script is functioning fine from the 
command prompt)

Here is what i have written

my $pid=fork();

#Starting child
if($pid) {
        $layout->addContent("<br /><p>" . "Script is running(PID: $pid). 
Should be done soon.". "</p>");
              if (defined($layout)) {
                   #  close(STDOUT);
       exec "/opt/soe/local/bin/perl /opt/soe/local/bin/ "; # Run 
script in background
       #exec "/opt/soe/local/bin/perl /opt/soe/local/bin/pres-upd-reports 
--report=basic-monthly-report-cpu --account=CSC "; # Run script in 


I tried to try a which sleeps for 10 secs , then i can see it 
running in ps -ef output but i asked it to touch a file in /tmp and it 
wasnt able to touch the file.

Any clue?? Please help.



CSC • This is a PRIVATE message. If you are not the intended recipient, 
please delete without copying and kindly advise us by e-mail of the 
mistake in delivery.  NOTE: Regardless of content, this e-mail shall not 
operate to bind CSC to any order or other contract unless pursuant to 
explicit written agreement or government initiative expressly permitting 
the use of e-mail for such purpose • Computer Sciences Corporation India 
Pvt Ltd • 7th,Floor, Block 1B, DLF IT Park, Sivaji Garden, Moonlight Stop, 
Nandambakkam Post, Ramapuram, Chennai-600 089.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About