To replace the command value in::

  <command mode="'shell'">'/acunix/utilities/quick_sanity/do_sanity.sh' 
</command>

using a Python variable named action that you define as:

  <script>
    action = '/acunix/utilities/quick_sanity/do_sanity.sh'
  </script>

you can do:

  <command mode="'shell'">action</command>

which would be the same as doing:

  <command mode="'shell'">'%s' % (action)</command>

I have no idea why you also set the command to additional Python variables 
build_path, qash_path, and acversion in your example (though you were 
using invalid Python syntax).  If these were supposed to be parameters 
passed in the do_sanity.sh, then you have to show me the complete command 
that you are trying to parameterize.  For example, If you were trying to 
run do_sanity.sh passing it three parameters as follows:

  <command mode="'shell'">
    '/acunix/utilities/quick_sanity/do_sanity.sh /work/_AIX5 
/acunix/work/QA/QASH R12'
  </command>

then you can do the following using your Python variables:

  <command mode="'shell'">
    '%s %s %s %s' % (action, build_path, qash_path, acversion)
  </command>

I think you really need to understand Python a little better.  There's 
lots of documentation available on the web that can help you.

Note that I'd advise you to make sure that you're creating a valid command 
before passing it to a <process> element to be run.  You can do some 
debugging and logging first to verify that the command you're specifying 
in Python is really what you want it to be.  For example:

<script>
  debug = 1
  command = '%s %s %s' % (action, build_path, qash_path, acversion)
</script>

<log message="1" if="debug == 1">'Command: %s' % (command)</log>

<process name="'Starting Quick Sanity Testing .....'">
  <location>machName</location>
  <command mode="'shell'">command</command>
  <stdout>dir_name_source</stdout>
  <stderr mode="'stdout'"/>
  <returnstdout/>
</process>

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




Sangram Bakshi <san...@gmail.com> 
03/02/2009 01:30 PM

To
staf-users@lists.sourceforge.net
cc

Subject
Re: [staf-users] Copying file from remote machine to user machine.






In the xml , i am trying to use variables to contain the respective paths 
as :
 
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "C:\STAF\stax.dtd">
<stax>
<!--
The following <script> element is overriden if the global_vars.py 
SCRIPTFILE is used
A SCRIPTFILE can be specified either in the STAX Monitor, or directly when 
submitting a job to STAX
-->
<script>
  machName = '155.35.7.24'
  from com.ibm.staf import STAFUtil
  action ='/acunix/utilities/quick_sanity/do_sanity.sh'
  build_path='/work/_AIX5'
  acversion='R12'
  qash_path='/acunix/work/QA/QASH'
  dir_name_source='/sangram/test.out'
  dir_name_dest='C:/STAF/stax_jobs'
 </script>
<defaultcall function="Main"/>
<function name="Main">
<sequence>
   <stafcmd name="'Delaying for 30 seconds  AAAAAAAA'">
                <location>machName</location>
                <service>'delay'</service>
                <request>'delay 30000'</request>
   </stafcmd>
      
   <process name="'Starting Quick Sanity Testing .....'">
        <location>machName</location>
        <command 
mode="'shell'">'/acunix/utilities/quick_sanity/do_sanity.sh ' </command>
  i would like this  as using variables as :< do let me know if this is 
ok>
        <command mode="'shell'"> action  build_path  qash_version 
acversion </command>
        <stdout>'/sangram/test.out'</stdout>
        <stderr mode="'stdout'"/>
        <returnstdout/>
   </process>
      
<if expr="RC !=0">
  <message>'RC: %s result: %s' % (RC, STAFResult)</message>
  
</if>


 
On Mon, Mar 2, 2009 at 6:52 PM, Sangram Bakshi <san...@gmail.com> wrote:
Hi ,
 
To add to the information. I am trying to execute the following xml :
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "C:\STAF\stax.dtd">
<stax>
<!--
The following <script> element is overriden if the global_vars.py 
SCRIPTFILE is used
A SCRIPTFILE can be specified either in the STAX Monitor, or directly when 
submitting a job to STAX
-->
<script>
  machName = '155.35.7.24'
  from com.ibm.staf import STAFUtil
  action ='/acunix/utilities/quick_sanity/do_sanity.sh'
  build_path='/work/_AIX5'
  acversion='R12'
  qash_path='/acunix/work/QA/QASH'
  dir_name_source='/sangram/test.out'
  dir_name_dest='C:/STAF/stax_jobs'
 </script>
<defaultcall function="Main"/>
<function name="Main">
<sequence>
   <stafcmd name="'Delaying for 30 seconds  AAAAAAAA'">
                <location>machName</location>
                <service>'delay'</service>
                <request>'delay 30000'</request>
   </stafcmd>
      
   <process name="'Starting Quick Sanity Testing .....'">
        <location>machName</location>
        <command 
mode="'shell'">'/acunix/utilities/quick_sanity/do_sanity.sh ' </command>
        <stdout>'/sangram/test.out'</stdout>
        <stderr mode="'stdout'"/>
        <returnstdout/>
   </process>
      
<if expr="RC !=0">
  <message>'RC: %s result: %s' % (RC, STAFResult)</message>
  
</if>
    <stafcmd name ="'Copying file from remote machine ..... '"> 

         <location>machName</location>
         <service>'FS'</service>
         <request>'COPY FILE /sangram/test.out TOFILE c:/STAF/stax_jobs/ 
TOMACHINE 155.35.3.229'</request>
     </stafcmd>
 
</sequence>
</function>
</stax>
 
 
But i am not able to copy file /sangram/test.out to machine 155.35.3.229 
from machine 155.35.7.24.
 
Regards
Sangram

On Mon, Mar 2, 2009 at 5:59 PM, Sangram Bakshi <san...@gmail.com> wrote:
Hi,
 
I want to copy files from a remote machine (m2) to machine (m1). I am 
running a stax xml application in machine m1 .
 
m1 ============== m2
 
A command is run on machine m2 from machine m1 through the xml . A report 
file is created at remote machine m2. I want to get the file from m2 to m1 
. How can i write it in the xml .
 
 
I  would like to do something like :
 
STAF m2 FS COPY FILE /sangram/test.log  TOFILE 
c:/STAF/staf_jobs/ TOMACHINE m2
 
I want to write this is the xml something like this 
 
 <stafcmd>
         <location>machName</location>
         <service>'FS'</service>
         <request>'COPY FILE /sangram/test.log  TOFILE 
c:/STAF/staf_jobs/ TOMACHINE m2'</request>
     </stafcmd>
 
Is this right .Kindly let me know if i am writing the proper thing in the 
xml.
 
Regards
Sangram
 
 
 
 
 
 
 
 
 

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, 
CA
-OSBC tackles the biggest issue in open source: Open Sourcing the 
Enterprise
-Strategies to boost innovation and cut costs with open source 
participation
-Receive a $600 discount off the registration fee with the source code: 
SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to