You could redirect the output from the command to a file to get the result
(e.g. the STAX job ID if successful or error information if the stax
execute request failed). For example:
STAF "1722W7.Fekete.com" STAX EXECUTE FILE
"D:\DistributedTesting\SilkTestDistribution\RunFromMediaFolder_Harmony.xml"
^
MACHINE "1722W7.Fekete.com" JOBNAME "HarmonyRegressionTestMediaFolder"
FUNCTION main ARGS "['Harmony', '%runVersion%']" ^
SCRIPT "PRODUCT='Harmony'" ^
SCRIPT "VERSION='%runVersion%'" ^
SCRIPT "BUILD='MainBuild'" ^
SCRIPT "BRANCHVER='Main'" ^
SCRIPT "TESTHOST='1722W7.Fekete.com'" CLEARLOGS ENABLED >
C:\stafOutput.txt
Or you can redirect the output from the entire .bat file to a file (though
then it will contain all the output from the .bat file). For example:
C:\stax>staxExecute.bat > c:\stafOutput.txt
Note that the redirected output in the file will contain "Response" and
"--------" lines before the result string unless you set environment
variable STAF_QUIET_MODE to a non-null value which will cause the STAF
command to only output the result string. For example, add the following
line to your .bat file before running the STAF command:
set STAF_QUIET_MODE=1
For more information about using the STAF command line executable within a
shell script (or .bat script), see section "5.2 STAF" in the STAF User's
Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRSTAFEXECMD. In
particular, see the sub-section called "Using the STAF command from
shell-scripts". It talks about the STAF_QUIET_MODE environment variable.
Note: If you use a program written in Python, Perl, Tcl, Java, or C++
instead of using the STAF command line executable in a .bat file, you can
use the STAF APIs provided for these languages which provides much more
flexibility in processing results that contain multiple fields as
unmarshalling APIs are provided so that no "parsing" of the result is
needed.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: "Zhu, Cindy" <cindy....@ihs.com>
To: "staf-users@lists.sourceforge.net"
<staf-users@lists.sourceforge.net>,
Date: 12/04/2013 05:39 PM
Subject: [staf-users] Calling STAF in a batch file
Hi,
I have the following STAF command to start a STAX job in a batch file
“run.bat”:
…….
STAF "1722W7.Fekete.com" STAX EXECUTE FILE
"D:\DistributedTesting\SilkTestDistribution\RunFromMediaFolder_Harmony.xml"
^
MACHINE "1722W7.Fekete.com" JOBNAME "HarmonyRegressionTestMediaFolder"
FUNCTION main ARGS "['Harmony', '%runVersion%']" ^
SCRIPT "PRODUCT='Harmony'" ^
SCRIPT "VERSION='%runVersion%'" ^
SCRIPT "BUILD='MainBuild'" ^
SCRIPT "BRANCHVER='Main'" ^
SCRIPT "TESTHOST='1722W7.Fekete.com'" CLEARLOGS ENABLED
Can you show me how I can log the results (STAS job id, errors, etc) to a
file?
Thanks,
Cindy
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users