Operating System - HP-UX
1819984 Members
3889 Online
109608 Solutions
New Discussion юеВ

Re: ksh command sqlplus and timeout

 
SOLVED
Go to solution
Leo The Cat
Regular Advisor

ksh command sqlplus and timeout

Hi


huh I'm probably turning around the solution.

Here my draft (of course it doesn't works)

spout="$(

$ORACLE_HOME/bin/sqlplus -silent "/ as sysdba" << EOF &
set echo off feedb off head off


connect test/test

/

exit success
EOF
sleep 4
kill %% 2>&1
)"

IN fact, i want to run this command and terminate after 5 seconds whatever is finished or not. (because sometime if instance not available cionnection is hanging)

Could you help me to find the good key. I'm not too far ....

Bests regards
Den.
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: ksh command sqlplus and timeout

Hi Den:

You could do:

#!/usr/bin/sh
function worker {
spout="$( ...
...
EOF
)
}
worker &
WORKER_PID=$!
sleep 5
kill ${WORKER_PID} 2>/dev/null
exit 0

Regards!

...JRF...
kill
Leo The Cat
Regular Advisor

Re: ksh command sqlplus and timeout

Hi James

Of course the trick with a function. It's the key !

Excellent
Thanks a lot.

Bests Regards
Den