[NTLUG:Discuss] C OK, sh OK, but it still doesn't seem to work

Fred James fredjame at concentric.net
Fri Nov 29 20:02:19 CST 2002


As a mind jogger, the situation is this:
(1) A PL/SQL procedure calls a C external procedure (function) that 
calls a sh script, which finally calls mailx.
(2) The PL/SQL is working, the C is working, the sh script works, but 
tie them all together and it fails without error.
(3) The sh script creates a text file of all the parameters passed to 
it, so I can tell it is getting everything it is suppose to, and 
understands them as they are supposed to be.
(4) The sh script creates a text file to send to mailx, so I can tell 
that it is forming the file correctly as well.

Here is a two line snippet of relevant C code:

sprintf(mailCmd, "/apps/oracle/local/lib/mail_utl.sh '%s' '%s' '%s' '%s' 
'%s'\n", pSubject, pRecipientList, pMessage, pAttach, pReturnAddress);
system(mailCmd);

Here is the one relevant line from the sh script (the extra ;echo "" is 
because it seemed to need an <CR>, and anyway I figured it couldn't hurt):

cat $Filename | mailx $RecipientList;echo ""

Now the facts:
(1) Run mail_utl.sh from the command line, and it all works fine.
(2) Let the PL/SQL call mail_utl.sh through the C function and it
     (a) writes all the files correctly.
     (b) doesn't send the mail.

Any clues would be appreciated.  This same general problem has been 
plaguing me all along - whatever I write works fine until I backup and 
start it all with the PL/SQL procedure - no error messages or codes, it 
just doesn't happen.





More information about the Discuss mailing list