#!/usr/bin/perl
use CGI qw(:standard);
$| = 1;
if (my $pid = fork) { #parent does
close STDOUT;
close STDIN;
close STDERR;
open STDIN, '<', '/dev/null';
open STDOUT, '>', '/dev/null';
my $err_file = "/var/www/html/cgi_data/error_log";
open STDERR, '>', $err_file;
start_x();
}
else
{
print header(), q~
New Site notification
My homepage has moved to a new location. I am here
~;
exit;
}
sub start_x
{
$com = "./myprog 100";
open PIPE, "$com |";
$outfile1 = "../html/cgi_data/page2.html";
open OUT, ">$outfile1" or die "Can not open for write: $outfile";
while ($data = )
{
print OUT "$data\n";
}
close OUT;
}