The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > BSD
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


BSD BSD, sometimes called Berkeley Unix, is a Unix operating system developed by the Computer Systems Research Group of the UC Berkeley.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
C/C++ IDE for FreeBSD tos High Level Programming 1 11-22-2002 08:07 AM
[help]FreeBSD could use how many cpu(x86) max? beggar_hong UNIX for Dummies Questions & Answers 3 10-21-2002 11:29 AM
FreeBSD - NAT Ivo IP Networking 1 04-15-2002 05:42 PM
Freebsd 4.5 Mindscan UNIX for Dummies Questions & Answers 1 03-29-2002 03:36 AM
need help with FreeBSD!!! lacasa UNIX for Dummies Questions & Answers 3 02-28-2001 11:19 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-2006
Registered User
 

Join Date: Feb 2006
Posts: 5
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
please help me in FreeBSD

Hi to all,

Iam doing a project in Free BSD and i am stuck with a puzzle. Please any one of you clarify my doubt :

How to add a mechanism to check the status of the file system which alerts the root user via. email if any single partition is greater than 90% full. This alert should include the file system directory name and the partition?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-11-2006
Registered User
 

Join Date: Feb 2006
Posts: 5
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Atleast help me with this !!

Iam working on Free BSD 5.3 version. U all know that the output of 'df' command looks as follows:

Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 253678 59116 174268 25% /
devfs 1 1 0 100% /dev
/dev/ad0s1e 253678 24280 209104 10% /tmp
/dev/ad0s1f 8913022 2615376 5584606 32% /usr
/dev/ad0s1d 253678 30246 203138 13% /var
devfs 1 1 0 100% /var/named/dev


Now i want to check which partition if greater than 90% full without scanning the first row of record. How to do this ? PLease anyone of u help me with this?
Reply With Quote
  #3 (permalink)  
Old 02-18-2006
Registered User
 

Join Date: Mar 2004
Location: Boise, Idaho, United States
Posts: 23
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I'm not a regular BSD user, but this can be done in a shell script using "cut"

look up the man page for "cut" and you should immediately see how you can use it to parse the output of df
Reply With Quote
  #4 (permalink)  
Old 02-27-2006
dsbeerf's Avatar
Registered User
 

Join Date: Dec 2005
Location: Chicago, IL USA
Posts: 58
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by tadakamalla
Iam working on Free BSD 5.3 version.
Now i want to check which partition if greater than 90% full without scanning the first row of record. How to do this ? Please anyone of u help me with this?
This is quick, done early in the morning, but it works. Please don't yell at my 'inefficiencies" ! :>D Streamline it as you will.
It more than likely NEEDS it BADLY.
===========

#!/bin/ksh

get_size () {

IFS="%
"
df -k | grep '\/dev\/' | awk '{ printf "%s\t%d\n",$6,$5 }'

IFS="
"

}

alm_func () {
LIM=$1
shift
NUM=`echo $#/2 | bc`
while [ $NUM -gt 0 ]
do
if [ $2 -gt $LIM ]; then
echo "Partition $1 is at $2'%'."
fi
shift;
shift;
((NUM=NUM-1))
done
}

#=======

if [ $# -ne 1 ]; then
echo "$0: Invalid number of arguments"
echo "usage: $0 <filesystem utilization limit>"
exit 1
fi

LIMIT=$1

alm_func $LIMIT `get_size`

======
IFS is usually "<space><tab><\n>" I add the '%'
as a lazy way to make it a field delimiter and 'subtract' it from the 'df -k' output. Dirty, I know. :>D

[top]
If you want the DEVICE name, substitute '$1' for the '$6' in the AWK statement in "get_size()"


==
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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



All times are GMT -7. The time now is 03:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102