mojo-jojo has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a perl CGI script which will ssh to different unix servers and get their space details using df -h command. The script works fine when I run it on the server but does not display anything when executed from a html page. The code is given below, request assistance.
#!/usr/bin/perl -w use strict; use warnings; use CGI; my $q = CGI->new(); print $q->header(); my @var = `ssh root\@lindpi001 \"df -hP | tr -s ' '\"`; print "<h1>Head</h1>"; my $varlength = @var; print "<h2>Length $varlength</h2>"; for (my $i = 0; $i < $varlength; $i++) { print "\n<b>$var[$i]</b>"; }
The lenghth @var array is zero when executed from an html page.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi script to retrieve disk space of unix servers
by moritz (Cardinal) on Aug 04, 2011 at 08:39 UTC | |
|
Re: cgi script to retrieve disk space of unix servers
by duyet (Friar) on Aug 04, 2011 at 10:08 UTC | |
by mojo-jojo (Novice) on Aug 04, 2011 at 10:10 UTC | |
by osbosb (Monk) on Aug 04, 2011 at 13:24 UTC | |
|
Re: cgi script to retrieve disk space of unix servers
by locked_user sundialsvc4 (Abbot) on Aug 04, 2011 at 23:09 UTC | |
by mojo-jojo (Novice) on Sep 05, 2011 at 12:49 UTC |