alikim has asked for the wisdom of the Perl Monks concerning the following question:
server.cgi#!/usr/bin/perl -w open(PID, "< pid") || die "Can't open PID file: $!"; $pid = <PID>; close PID; if(defined $pid){ if($pid==0){ # print "Location: http://test/test.html \n\n"; print "Content-type: text/html\n\n"; print "<html>hello<html>"; exec '/usr/sites/test/vcgi/server.cgi'; } }
Both programs and pid file are located at '/usr/sites/test/vcgi' which is set as 'cgi-bin' dir in Apache config file. Start.cgi is executed from a browser. It checks if server.cgi is on (reading pid file) runs it if it's not and returns 'hello'. At the beginning pid file contains '0'. test.html page contains nothing but html and body tags#!/usr/bin/perl -w # use IO::Socket; open(PID, "> pid") || die "Can't open PID file: $!"; print PID $$ ; close PID;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI problems - please help
by bobn (Chaplain) on Sep 11, 2003 at 13:01 UTC | |
by alikim (Initiate) on Sep 11, 2003 at 13:22 UTC | |
|
Re: CGI problems - please help
by zby (Vicar) on Sep 11, 2003 at 12:58 UTC | |
by alikim (Initiate) on Sep 11, 2003 at 13:20 UTC | |
by zby (Vicar) on Sep 11, 2003 at 13:38 UTC |