logwatch patches - disk_space
"gulikoza" <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
This has always bothered me, the disk_space script will not sort human readable sizes :-) This would be easy to solve if coreutils >= 7.5 is used (sort -h) but it's a bit more complicated otherwise. Patch attached. Regards, gulikoza ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Logwatch-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-disk_space.patch
(application/octet-stream, 548 B)
diff --git a/scripts/services/zz-disk_space b/scripts/services/zz-disk_space
--- a/scripts/services/zz-disk_space
+++ b/scripts/services/zz-disk_space
@@ -47,7 +47,8 @@
sub DirUsage {
my $Dir = $_[0];
if ($OSname eq "Linux") {
- system("du -s --block-size=1048576 -h $Dir | sort -n -r -k 1");
+ # TODO: use sort -h when coreutils >= 7.5
+ system("du -sk $Dir | sort -nr | cut -f2 | xargs -d '\n' du -sh");
} elsif ($OSname eq "Darwin") {
system("du -s --block-size=1048576 -h $Dir | sort -n -r -k 1");
} elsif ($OSname eq "SunOS") {