[Logwatch-Devel] Update to zz-disk_space for Mac OS X

laurent.dufour at havas.com laurent.dufour at havas.com
Tue Jan 17 08:07:56 MST 2006




Hi guys,

I'm just sending a patch for zz-disk_space in order to show appropriate
data in Mac OS X
It is to apply to logwatch-7.1

Bye.



--- zz-disk_space-7.1   Tue Jan 17 15:41:40 2006
+++ zz-disk_space       Tue Jan 17 16:00:47 2006
@@ -31,7 +31,7 @@

 sub DirUsage {
     my $Dir = $_[0];
-       if ($OSname eq "Linux") {
+       if (($OSname eq "Linux") || ($OSname eq "Darwin")){
                system("du -s --block-size=1048576 -h $Dir | sort -n -r -k
1");
        } elsif ($OSname eq "SunOS") {
                if ( ($release eq "5.10") || ($release eq "5.9") ) {
@@ -83,7 +83,7 @@
     print "Size    Location\n";
     print "(GB)\n";

-       if ($OSname eq "Linux") {
+       if (($OSname eq "Linux") || ($OSname eq "Darwin")) {
                DirUsage("/var/log");
                DirUsage("/usr");
        } elsif ($OSname eq "SunOS") {
@@ -107,10 +107,11 @@
 sub DiskSpace ()
 {

-       if ($OSname eq "Linux") {
+       if (($OSname eq "Linux") || ($OSname eq "Darwin")) {
                my $awkprog='{printf("%-35s %6s %6s %6s %4s  %s\n", $1, $2,
$3, $4, $5, $6); }';
                system("echo 'Filesystem:Size:Used:Avail:Use%:Mounted on' |
awk -F: '$awkprog' ");
-      system("df -P -h | awk '/^[/ ]/ $awkprog' | sort -b -r -n -k 5 ");
+               if ($OSname eq "SunOS") { system("df -P -h | awk '/^[/ ]/
$awkprog' | sort -b -r -n -k 5 "); }
+               else { system("df -P -h |  grep '^/dev/' |awk '$awkprog' |
sort -b -r -n -k 5 "); }
        } elsif ($OSname eq "SunOS") {
                if ( ($release eq "5.10") || ($release eq "5.9") ) {
                        system("/usr/xpg4/bin/df -P -h | grep '^/dev/'");



----------------------------------------------------------------------------------------

Laurent DUFOUR - HAVAS IT
Vice Chief Technical Officer - Directeur Technique Adjoint
2 Allée de Longchamp - 92281 - Suresnes - France
tel: +33 (0)158478830 - fax: +33 (0)1 58478815
mailto:laurent.dufour at havas.com
http://www.havas.com
----------------------------------------------------------------------------------------




More information about the Logwatch-Devel mailing list