Revision: 2766
http://ipcop.svn.sourceforge.net/ipcop/?rev=2766&view=rev
Author: owes
Date: 2009-05-02 09:02:35 +0000 (Sat, 02 May 2009)
Log Message:
-----------
Fix display of disk space usage
Modified Paths:
--------------
ipcop/trunk/html/cgi-bin/updates.cgi
Modified: ipcop/trunk/html/cgi-bin/updates.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/updates.cgi 2009-05-01 11:32:39 UTC (rev
2765)
+++ ipcop/trunk/html/cgi-bin/updates.cgi 2009-05-02 09:02:35 UTC (rev
2766)
@@ -314,8 +314,14 @@
my $patchsize = 0;
$patchsize = (stat('/var/patches/patch.tgz.gpg'))[7] / 1024 / 1024 if (-e
'/var/patches/patch.tgz.gpg');
- # alert on rootfs available < 20MB, on boot 1MB, on /var/log 1MB
- my @alert = (20 - $patchsize, 1, 1);
+ # merge all lines to one single line separated by spaces
+ my $all_inOneLine = join(' ', @df);
+
+ # now get all entries in an array
+ my @all_entries = split(' ', $all_inOneLine);
+
+ # alert on rootfs available < 32MB, on /var/log 1MB
+ my @alert = (32 - $patchsize, 1);
print <<END
<hr />
<table width='100%' border='0'><tr><td width='15%'> </td><td>
@@ -331,23 +337,33 @@
</tr>
END
;
- for (my $count = 0; $count <= $#df; $count++) {
- my $tmp = ((@df))[$count];
- $tmp =~ /([\w\/]+)\s+(\d+)M\s+(\d+)M\s+(\d+)M\s+(\d+)%\s+([\w\/]+)/;
- my ($dev, $mount, $size, $used, $free, $percent) = ($1, $6, $2, $3,
$4, $5);
+
+ my $count = 0;
+ # loop over all entries. Six entries belong together.
+ while (@all_entries > 0) {
+
+ my $dev = shift(@all_entries);
+ my $size = shift(@all_entries);
+ my $used = shift(@all_entries);
+ my $free = shift(@all_entries);
+ my $percent = shift(@all_entries);
+ my $mount = shift(@all_entries);
+
my $alertstyle = "";
- $alertstyle = "style='background-color: #FF0000;'" if ($4 <=
$alert[$count]);
+ $alertstyle = "class='ipcop_error'" if ($free <= $alert[$count]);
print <<END
- <tr>
+ <tr $alertstyle>
<td>$dev</td>
<td>$mount</td>
- <td align='right' $alertstyle>$size</td>
- <td align='right' $alertstyle>$used</td>
- <td align='right' $alertstyle>$free</td>
- <td align='right' $alertstyle>$percent%</td>
+ <td align='right'>$size</td>
+ <td align='right'>$used</td>
+ <td align='right'>$free</td>
+ <td align='right'>$percent</td>
</tr>
END
;
+
+ $count++;
}
print "</table></td></tr></table>";
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn