Control de Oracle Conexion
hora_ant="99"
while true
do
date ’+%Y-%m-%d %H:%M:%S’ >>test_conn_NODO.log
r=$(echo "select ’CONNECTION OK’ R from dual;" | sqlplus usuario/contraseña@SID | tee -a test_conn_NODO.log)
ok=$(grep "CONNECTION OK" <<<$r)
if [ -z "$ok" ]
then
c=’X’
else
c=’.’
fi
if [ "$hora_ant" -ne "$(date ’+%H’)" ]
then
echo >>test_conn_NODO.log
echo -n "$(date ’+%Y-%m-%d %H:%M:%S’): " >>test_conn_NODO.log
hora_ant=$(date ’+%H’)
fi
echo -n $c >>test_conn_NODO.log
echo >>test_conn_NODO.log
sleep 60
done
0 comentarios