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.
In reply to cgi script to retrieve disk space of unix servers by mojo-jojo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |