[ start | index | login ]
start > Virtual Brain > Linux > Disksize Checking

Disksize Checking

Created by stefan. Last edited by stefan, 6 years and 199 days ago. Viewed 558 times. #2
[diff] [history] [edit] [rdf]
labels
attachments
Overflowing disks? Yes, there are… A simple checker script helps.

Adapted to Linux from: >>http://sunportal.sunmanagers.org/pipermail/summaries/2001-November/000398.html

#!/bin/bash
# Set up variable for who is to be mailed
ADMIN_MAIL="mail@host.domain"

# The maximum percent that the disk slices are allowed to grow to MAXSIZE=80

# The Command to check the disks and strip out unwanted variables DISKSIZES=`df -k |grep / |awk '{print $5}' |sed -e 's/%//'`

# Take the input from the df command above for percent in $DISKSIZES do

# If the percent is greater than the maximum percent that the disk # slices are allowed to grow to if [ $percent -gt $MAXSIZE ] then

# Mail a df -k to the specified person(s) df -h | mail -s "Disk Space Problem on $HOSTNAME " $ADMIN_MAIL

fi

done

no comments | post comment
search www.stefanrufer.ch
Google

Content

Me?


Blog Calendar

< February 2012 >
SunMonTueWedThuFriSat
1234
567891011
12131415161718
19202122232425
26272829

Weblog summary 2007, 2006, 2005, 2004


Content managed by SnipSnap

M

snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt