Re: Archive log destination space check - shell script

2001-06-26 Thread Viraj Luthra

Thanks Jared for the script, have modified (the little that had to be done :-), and 
works like a charm.

the next problem that I have, is that I want to make this an automatic affair, so I 
want that this shell should first read the parameter, LOG_ARCHIVE_DEST, get the 
archive destination from there and see if the file system is more than 80% or not? 

so i think i will first connect to an sqlplus session and get this going in the shell.

any more ideas, appreciate it.
viraj
 
--

On Mon, 25 Jun 2001 21:40:30  
 Jared Still wrote:
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).



Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viraj Luthra
  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).



Archive log destination space check - shell script

2001-06-25 Thread Viraj Luthra

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.

Does any one have a great script like this or do I have to re-invent the wheel?

Rgds,

raja


Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viraj Luthra
  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).



Re: Archive log destination space check - shell script

2001-06-25 Thread Jared Still

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).