vhaphisasset has asked for the wisdom of the Perl Monks concerning the following question:
Good day Monks! I have been searching the web and trying different variations of code so that the end user via a web interface can see all of the server backup logs and select anyone of them to read the log. I am working on a test system which is RHEL 6. There is the dir "/var/log/vista/stcr2tsvr/" where the backup logs are stored and it has files in it. I have even chmod 777 all of the dirs. and files (Just for testing)When I call the script from IE I get the standard server error and when I tail /var/log/httpd/error_log I am presented with the following:
I am unsure where I am going wrong with the code:Tue Feb 24 14:11:10 2015] [error] [client 10.*.*.*] (2)No such file or + directory: exec of '/var/www/cgi-bin/rdp_backuplogs_test' failed [Tue Feb 24 14:11:10 2015] [error] [client 10.*.*.*] Premature end of +script headers: rdp_backuplogs_test
#!usr/bin/perl use strict; use CGI; my $list = new CGI; my $fileDir = "/var/log/vista/stcr2tsvr/"; my @files; print $fileDir; opendir DIR, "$fileDir"; @files = grep(/\.log$/,readdir(DIR)); ## Example file to read 2015 +0210-dubr3psvr-backup.log closedir DIR; print $list->header("text/html"), $list->start_html("Files in $fileDir"), $list->p("These are the files in $fileDir"); foreach my $file (@files) { print $list->p( $list->a({-href=>$file}, $file) ); } print $list->end_html;
I am learning perl and have been able to write several other processes for the web application which is a sysadmin portal for our Linux environment in both perl and BASH scripts. I have seen examples of this code here and on other sites but I can’t seem to figure out what is wrong. Thanks in advance for looking at this and please excuse my ignorance.
|
|---|