How are you trying to run this shell script via STAX?  You didn't provide 
your STAX job that shows how you are trying to run this shell script.

Are you trying to run this shell script via a <process> element?  For 
example, if your shell script was in a file named /tests/runSQL.sh (and it 
exists on the machine where you are trying to run it), then your STAX job 
could look like the following:

<process name="'Run SQL'">
  <location>machine</location>
  <command mode="'shell'">'/tests/runSQL.sh'</command>
  <stderr mode="'stdout'"/>
  <returnstdout/>
</process>

<if expr="RC != 0">
  <log level="'error'">
    'Process failed with RC=%s, STAFResult=%s, STAXResult=\n%s' % (RC, 
STAFResult, STAXResult)
  </log>
</if>

Also, if sqlplus is trying to access stdin then it may be "hanging" when 
it tries to access stdin.  To prevent this, you may need to specify an 
empty stdin file and include that.  For example, on the machine when you 
are running this shell script, create an empty file (e.g. touch 
/tests/empty.txt) and use it for the <stdin> sub-element.

<process name="'Run SQL'">
  <location>machine</location>
  <command mode="'shell'">'/tests/runSQL.sh'</command>
  <stdin>'/tests/empty.txt'</stdin>
  <stderr mode="'stdout'"/>
  <returnstdout/>
</process>

<if expr="RC != 0">
  <log level="'error'">
    'Process failed with RC=%s, STAFResult=%s, STAXResult=\n%s' % (RC, 
STAFResult, STAXResult)
  </log>
</if>

Also, you may want to first try to run this command via a STAF PROCESS 
START request (which is what STAX submits under the covers for each 
<process> element) for easier debugging.  For example:

STAF local PROCESS START SHELL COMMAND "/tests/runSQL.sh" STDIN 
"/tests/empty.txt" STDERRTOSTDOUT RETURNSTDOUT WAIT

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




----- Message from "Yashaswi S. Kumar" <yashaswi.ku...@sanovi.com> on Tue, 
28 Feb 2012 05:14:41 -0600 (CST) -----
To:
<staf-users@lists.sourceforge.net>
Subject:
Running SQLPlus through STAF

Hi all,
Here is my code Snippet
#!/bin/bash
 
ORA_CLIENT_HOME=$EAMSROOT/tools/oracle/instantclient_11_2
 
export LD_LIBRARY_PATH=$ORA_CLIENT_HOME
echo "Inside shutdown database"
if [ $# -lt 4 ]; then
        
        echo "Usage: $0 <oracleusername> <password> <IP> <DBNAME>";
                echo "Example: $0  sys sanovi 172.168.1.213 orasan" ;
                        exit 1;
                        fi
echo $1
echo $2
#sqlplus is hardcoded
/opt/panaces/tools/oracle/instantclient_11_2/sqlplus "$1/$2@(DESCRIPTION 
=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =$3)(PORT 
=1521)))(CONNECT_DATA = (SRVR=DEDICATED)(SERVICE_NAME = $4)(SID= $4))) as 
sysdba"<<EOF
shutdown immediate
EOF
 
I’m trying to run the same code using STAX.
But it is not able to execute and is not throwing any errors also!
 
Please help asap!
 
Yashaswi S Kumar
Software Engineer
Sanovi Technologies Pvt. Ltd.
* yashaswi.ku...@sanovi.com
' +91 80 4076 2044
À +91 97423 89087
ý  www.sanovi.com

 

----- Message from staf-users-requ...@lists.sourceforge.net on Unknown 
-----
Subject:
confirm ede22931db5ea136ee92fcda0946dbab9f458d8a

If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message.  Do this if the message is
spam.  If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list.  The Approved: header can also appear in the first line
of the body of the reply.

<<image/jpeg>>

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to