The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Modify FileSystems on AIX panchpan AIX 3 04-18-2008 07:10 AM
resize filesystems mhbd UNIX for Advanced & Expert Users 1 01-25-2008 05:16 AM
Vdump of two filesystems geraldwilson Filesystems, Disks and Memory 4 03-21-2005 10:03 AM
mounted filesystems jalburger UNIX for Dummies Questions & Answers 3 09-18-2002 04:32 PM
Filesystems marun UNIX for Advanced & Expert Users 9 09-04-2001 07:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-13-2002
YS2002 YS2002 is offline
Registered User
  
 

Join Date: Jun 2002
Posts: 6
Filesystems GT 95%

Hi
How can I only print the file systems that are more than 95% full.
I used the df -k output and tried to check for each file system and then print only the ones that meet the criteria... But my solution seems cloodgie ...
  #2 (permalink)  
Old 09-13-2002
benthebat benthebat is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 1
Hey, put your scripts up so that we can see if there is any better solution.
  #3 (permalink)  
Old 09-28-2002
ganti ganti is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 25
df -k |awk '($2-$3)/$2*100 > 95 {print $0}'

You can print $1(file-system) or $7(mounted directory) instead of $0

Good Luck
  #4 (permalink)  
Old 09-30-2002
auswipe's Avatar
auswipe auswipe is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Wide Awake Wylie, Texas
Posts: 535
I had to search, but I had written this Perl script for automatic notification if the filesystem was greater than some arbirtary percentage:

Code:
#!/usr/bin/perl

# auswipe, 5 Apr 2002
# Tested under OpenBSD 2.9
# auswipe sez : "No guarantees!"

$upperLimit = 80;              # Upper Limit in % for a File System
$mailTarget = "joe\@blow.com"; # Target for the automatic e-mail message

open(STATS, "df -h\|grep '%'|") || die "$!";

my @fileStats = <STATS>;

foreach $entryLine (@fileStats) {
  chomp($entryLine);
  $entryLine =~ s/\s+/ /g;
  my @fsStats = split(/ /, $entryLine);
  $fsStats[4] =~ s/%//g;
  if ($fsStats[4] >= $upperLimit) {
    open(MAIL, "|mail -s \"FileSystem $fsStats[0] Getting Full!\" $mailTarget ") || die "Can't open m
ail!";
    select(MAIL);
    print << "EOF";

    The FileSystem $fsStats[0] is getting full.
    Currently, the file system is ${fsStats[4]}% full. The upper
    limit has been placed at ${upperLimit}%.

    Please attend to this matter.

    -auswipe

    This message has been created automatically. Please do not respond to this message.
EOF
    close(MAIL);

  };
};
close(STATS);
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0