Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: calling Unix commands via external C routine.

Re: calling Unix commands via external C routine.

From: PD Miller <millerp_at_caribdata.co.uk>
Date: Wed, 17 May 2000 11:14:15 +0100
Message-Id: <10500.105827@fatcity.com>


At 10:36 am +0100 17/5/00, John Dunn wrote:
>Having masterd calling external C procedures in Oracle 8.0.5 I now want to
>be able to run Unix(AIX) commands(and get return code) from such a C
>routine.
>
>Currently I am using DBMS_PIPE but this is a pain as it needs a daemon
>running to listen for messages.
>
>Is there a definitive piece of C code anywhere that I can use to run Unix
>commands?
>
>One complication....I want to run some commands remotely via rsh(and get the
>return codes from those commands(rather than from rsh))

I haven't written one yet, but I think that the routine would be much the same as the pipe method which I use. I just fork(), exec() and close stdin and stdout appropriately sending stream data to the child from the parent. Getting a return code from the args to rsh will be more difficult. Possibly the easiest will be to rsh without a command arg and use stdin/stdout/stderr to execute the remote commands. You could then check $? for return codes and propogate them back via the parent.

HTH Paul Miller

-
Carib Data Limited

<mailto:millerp_at_caribdata.co.uk>
<http://www.caribdata.co.uk> Received on Wed May 17 2000 - 05:14:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US