On Monday 25 June 2001 20:00, Viraj Luthra wrote:
> Hello all,
>
> I had seen a unix shell script on this list, which basically checks the
> space availability for the archive log. If the space is less than 10%
> available for the archive log, then it can send a pager or email stating
> that.
Here, I whipped one up for you, completely untested.
Your mission, should you choose to accept it, is to
complete the missing portions. This would include
a correct email address ( or pager address ), the
appropriate action to take when the filesystem is
too full, and of course, specifying the correct
filesytem to check.
And of course, make sure it works.
This message will never self destruct, as I'm sure
there are several unknown servers archiving this
entire list to parts unknown.
Jared
----------------
#!/usr/bin/ksh
USRBIN=/usr/bin
BIN=/bin
MAILX=$USRBIN/mailx
AWK=$USRBIN/awk
CUT=$USRBIN/cut
DF=$BIN/df
GREP=$USRBIN/grep
DATE=$BIN/date
FIND=$USRBIN/find
RM=$BIN/rm
XARGS=$USRBIN/xargs
FILESYSTEM=/u02
ARCH_DIR=$FILESYSTEM/arch/db01
MAX_PCT_USED=20
[EMAIL PROTECTED]
PCT_USED=$($DF -k /u02 | $GREP -v ^Filesystem | $AWK '{ print $5 }' | $CUT -d% -f1)
echo PCT USED: $PCT_USED
[ $PCT_USED -gt $MAX_PCT_USED ] && {
# log your actions here in some log file
# LOGDATE=$( $DATE +%Y%m%d:%H%M%S )
# LOGFILE=$ORACLE_HOME/admin/bdump/archive_move.log
# echo $LOGDATE - cleaning up log dir
# tell somebody
echo "filesystem $FILESYSTEM is $PCT_USED full " | $MAILX -s 'Hey! Cleaning
up archive logs' $ADDRESS
for f in $( $FIND $ARCH_DIR -name "arch*.log" -print )
do
$ECHO $f
#$ECHO $f >> $LOGFILE
# remove file?
#$RM $f
# ftp file somewhere, back it up, etc...
# your commands here
done
}
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jared Still
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).