- Oracle en Espanol - Por Francisco Munoz Alvarez - http://oracleenespanol.com -

status with colors :D

Posted By hmiranda On 13. June 2008 @ 00:15 In Monitoreo, Scripts | 2 Comments

####### $HOME/bin/status #################

#!/bin/bash
SETCOLOR_SUCCESS=”\33[1;32m”
SETCOLOR_FAILURE=”\33[1;31m”
SETCOLOR_WARNING=”\33[1;33m”
SETCOLOR_NORMAL=”\33[0;39m”

lsnrctl status > /dev/null 2>&1

if test $? == 0 ; then
echo -en “Listener $SETCOLOR_SUCCESS OK $SETCOLOR_NORMAL \n”
else
echo -en “Listener $SETCOLOR_FAILURE FAIL $SETCOLOR_NORMAL \n”
fi
for i in $(cat /etc/oratab | grep -v “#” | strings | awk -F: ‘{print $1}’) ; do
if test “” != “$(ps -fea | grep pmon | grep $i)” ; then
echo -en “$i \t $SETCOLOR_SUCCESS OK $SETCOLOR_NORMAL $SETCOLOR_WARNING\t”
export ORACLE_SID=$i
sqlplus -S / as sysdba <<EOF
@$HOME/bin/status.sql
EOF
echo -en “$SETCOLOR_NORMAL”
else
echo -en “$i \t $SETCOLOR_FAILURE FAIL $SETCOLOR_NORMAL \n”
fi
done

############################################################

############## $HOME/bin/status.sql #############################

set feedb off
set pages 0
select status from v$instance ;

############################################################


2 Comments To "status with colors :D"

#1 Comment By admin On 13. June 2008 @ 13. June 2008

Horacio,

Cuando trato de ejecutarlo tengo los siguientes errores:

./status.sh: line 1: 32m.: command not found
./status.sh: line 2: 31m.: command not found
./status.sh: line 3: 33m.: command not found
./status.sh: line 4: 39m.: command not found
.Listener .33[1 OK .33[0 n.awk: cmd. line:1: .{print
awk: cmd. line:1: ^ syntax error
awk: cmd. line:2: (END OF FILE)
awk: cmd. line:2: syntax error

Saludos.


Article printed from Oracle en Espanol - Por Francisco Munoz Alvarez: http://oracleenespanol.com

URL to article: http://oracleenespanol.com/2008/06/13/status-with-colors-d/

Click here to print.