Computing.Net > Forums > Database > Shell Script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Shell Script

Reply to Message Icon

Name: arunpathak85
Date: May 5, 2009 at 06:34:37 Pacific
OS: HP-UNIX
Subcategory: General
Comment:

Can any body provide me the shell script for checking a filesystem size and once it goes above a provided threshold the automatic backup starts...



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: June 4, 2009 at 10:44:46 Pacific
Reply:

This is a database forum. This however might give you a start.

#!/bin/ksh
MAILTO="user@host.com"
echo "df -k output for `date` `uname -a`" > /tmp/df.out
case `uname -s` in
SunOS | Linux | OSF1 | UNIX_SV | FreeBSD )
if [ -s "/etc/redhat-release" ] ; then cat /etc/redhat-release >> /tmp/df.out ; fi
set -- `df -k | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $5, $6) }'`
;;
HP-UX )
set -- `bdf | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $5, $6) }'`
AIX )
set -- `df -k | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $4, $7) }'`
;;
esac

while [ $# -ge 2 ] ; do
CAPACITY=$1
FS=$2
shift 2

if [ $CAPACITY -gt 90 ] ; then
echo "$FS is at $CAPACITY %" >> /tmp/df.out
fi
done
if [ `wc -l /tmp/df.out | awk '{ print $1 }'` -ge 2 ] ; then
cat /tmp/df.out | mail -s "`date`" $MAILTO
fi


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Shell Script

help with shell script www.computing.net/answers/dbase/help-with-shell-script/459.html

executing shell script from pl/sql procedure www.computing.net/answers/dbase/executing-shell-script-from-plsql-procedure/741.html

script change column 22 www.computing.net/answers/dbase/script-change-column-22/535.html