J
Jim Isaacson
Hi
I have a html doc that calls a perl cgi script to list or write a scsi tape.
If I submit from the html document on the local machine it displays the html
in the cgi script and then reads the tape. If I go to any other machine and
submit from the html doc it waits until it gets enough data and then
displays the html and tape listing ino. It's like its buffering data when
not run from the web server? It's driving me crazy and users think the link
is broken as it stays on the html page for so long. I've tried using $| = 1
and autoflush, it works fine on the local server, just not remotely from any
other machines browser.
Any help is appreciated, here it the cgi script and it runs on an Apache
2.0.55 server on Redhat linux.
Thanks
Jim
#!/usr/bin/perl
use FileHandle;
require "cgi-lib.pl";
&ReadParse(*in);
STDOUT->autoflush(1);
$file = $in{'file'};
$failed = 0;
$LOG = "/usr/local/apache2/htdocs/logs/tapelog.log";
print &PrintHeader;
print <<EOF;
<H1><CENTER>Writing file Tape</CENTER></H1>
EOF
print "<HTML><BODY>";
print "<h2>";
print "Writing $file tape now...Please Wait for Tape Complete Message<br>";
print "This can take up to 40 minutes...<br><br>";
print "</h2>";
print "<h3>";
print "<PRE>";
if(open(PIPE, "/usr/local/bin/rtape -t /dev/st0 $file 2>/tmp/tapewrite |"))
{
while(<PIPE>) {
print "$_";
}
}
if(-s "/tmp/tapewrite") {
$failed = 1;
$status = "Failed";
unlink("/tmp/tapewrite");
}
else {
$status = "Successful";
}
$date = `date '+%m/%d/%y %H:%M:%S'`;
chomp($date);
open(LOG, ">>$LOG") || die "Unable to open $LOG file\n";
print LOG "$date|$file|$status\n";
close(LOG);
print "</h3>";
print "<br>";
print "<br>";
print "<h2>";
if($failed) {
print "Write of $file tape Failed<br><br>";
}
else {
print "Write of $file tape complete<br><br>";
}
print "<A HREF=\"/index.html\">Return to Main Tape Page </A>";
print "</h2>";
print "</html></body>";
I have a html doc that calls a perl cgi script to list or write a scsi tape.
If I submit from the html document on the local machine it displays the html
in the cgi script and then reads the tape. If I go to any other machine and
submit from the html doc it waits until it gets enough data and then
displays the html and tape listing ino. It's like its buffering data when
not run from the web server? It's driving me crazy and users think the link
is broken as it stays on the html page for so long. I've tried using $| = 1
and autoflush, it works fine on the local server, just not remotely from any
other machines browser.
Any help is appreciated, here it the cgi script and it runs on an Apache
2.0.55 server on Redhat linux.
Thanks
Jim
#!/usr/bin/perl
use FileHandle;
require "cgi-lib.pl";
&ReadParse(*in);
STDOUT->autoflush(1);
$file = $in{'file'};
$failed = 0;
$LOG = "/usr/local/apache2/htdocs/logs/tapelog.log";
print &PrintHeader;
print <<EOF;
<H1><CENTER>Writing file Tape</CENTER></H1>
EOF
print "<HTML><BODY>";
print "<h2>";
print "Writing $file tape now...Please Wait for Tape Complete Message<br>";
print "This can take up to 40 minutes...<br><br>";
print "</h2>";
print "<h3>";
print "<PRE>";
if(open(PIPE, "/usr/local/bin/rtape -t /dev/st0 $file 2>/tmp/tapewrite |"))
{
while(<PIPE>) {
print "$_";
}
}
if(-s "/tmp/tapewrite") {
$failed = 1;
$status = "Failed";
unlink("/tmp/tapewrite");
}
else {
$status = "Successful";
}
$date = `date '+%m/%d/%y %H:%M:%S'`;
chomp($date);
open(LOG, ">>$LOG") || die "Unable to open $LOG file\n";
print LOG "$date|$file|$status\n";
close(LOG);
print "</h3>";
print "<br>";
print "<br>";
print "<h2>";
if($failed) {
print "Write of $file tape Failed<br><br>";
}
else {
print "Write of $file tape complete<br><br>";
}
print "<A HREF=\"/index.html\">Return to Main Tape Page </A>";
print "</h2>";
print "</html></body>";