The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
calling procedure from script scorpio Shell Programming and Scripting 3 05-26-2008 11:37 AM
Calling stored procedure from shell script dorisw Shell Programming and Scripting 3 06-12-2007 05:03 PM
DB2 stored procedure (with input parameters) from script mpang_ Shell Programming and Scripting 1 12-13-2006 08:12 AM
run shell script from oracle store procedure arnabb4u Shell Programming and Scripting 8 08-16-2006 12:16 PM
calling stored procedure from shell script. priyamurthy2005 Shell Programming and Scripting 2 04-21-2005 07:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-18-2002
vidireporting vidireporting is offline
Registered User
  
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
Unhappy Starting a script from a Database procedure

Hey guys,

I have this problem : I can run on an sqlprompt

!ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous

which will ftp the file from Unix to an NT machine, but if I do

exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING.

I have no .netrc file in my home directory and don't know how to build it, but I even don't know if this file is necessary for me ?

Can u please help ??????
  #2 (permalink)  
Old 01-18-2002
edog edog is offline
Registered User
  
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
I've used this package and daemon process to execute system commands from the database, it worked for what I wanted. it may be worth lookin at. I needed to execute a shell script after some sql was triggered

hth

http://www.greatchinatelecom.com/card/oracle/14082.html
  #3 (permalink)  
Old 01-18-2002
vidireporting vidireporting is offline
Registered User
  
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
Thx edog !

But the problem is that it took already one month to let dba's and unix people set up the method with the shell procedure and next week we'll go in production already so I can't use your option (But I will definitely use it in a next project) !



by the way, here 's the code from the script I start


###############################################################################
# --------------
# Parm's control
# --------------
INPUTFILE=test.xml
DESTINATION=172.16.204.81
USERID=Anonymous
PASSWD=Anonymous
DIRECTORY=""
CHANGE_DIR='No'
# ---------------
# Execute the FTP
# ---------------
if [[ "$CHANGE_DIR" = "No" ]] ; then
ftp -n ${DESTINATION} >templog1$$ >>templog2$$ << EOF
user ${USERID} ${PASSWD} account
put ${INPUTFILE}
EOF
RCOD=$?
# ---
else
# ---
ftp -n ${DESTINATION} >templog1$$ >>templog2$$ << EOF
user ${USERID} ${PASSWD} account
cd ${DIRECTORY}
put ${INPUTFILE}
EOF
RCOD=$?
fi
# --> Save return code
RCOD=$?
# --> Remove logs file (to comment for debug)
rm templog1$$ templog2$$
# --> check FTP run
if [ $RCOD -ne 0 ] ; then
echo "ERROR: Load of file $INPUTFILE crash with error $RCOD"
exit 2
fi
# ---------------------
# Now it's time to exit
# ---------------------
exit $RCOD
  #4 (permalink)  
Old 01-18-2002
edog edog is offline
Registered User
  
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING.



what does your sql procedure, 'shell' look like? I assume its a custom procedure, maybe if you enter the full path of the ksh script, but I'd need to see the procedure venture any other guesses.

when you execute it from sqlplus your .profile probably has the path to ftp_file2.ksh or you were in that directory when you started sqklplus, but from a sql procedure there is no profile to find the script? just a thought
  #5 (permalink)  
Old 01-21-2002
vidireporting vidireporting is offline
Registered User
  
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
(sorry for the delay - just passed the weekend) :-)

The shell procedure :

procedure shell (cmd IN CHAR)
as external
name "sh"
library shell_lib
language C
parameters (cmd string);

This is just the standard one provided by Oracle.

That from the .profile is right i gess because
!ftp_file.ksh is executed on the unix prompt
while
exec shell('...'); goes through the Listener.

I did send the system people the procedure to setup the listener - maybe they just have forgotten. Anyway, i did send them a mail about that.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0