STAF provides a system variable named STAF/Config/OS/Name that provides 
the operating system name.  You could simply resolve that STAF variable 
using the STAF VAR service.  For example:

C:\>STAF targetMachine VAR RESOLVE STRING {STAF/Config/OS/Name}
Response
--------
Linux

If you really wanted the output from running command "uname -s" using the 
STAF PROCESS service, then an example of the correct request syntax is:

C:\>STAF targetMachine PROCESS START SHELL COMMAND "uname -s" WAIT 
RETURNSTDOUT STDERRTOSTDOUT
Response
--------
{
  Return Code: 0
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       : Linux

    }
  ]
}

You need to use the WAIT option on the PROCESS START request to run the 
command synchronously (to wait for the command to complete) instead of 
asynchronously and you need to return stdout/stderr to get the output from 
running the "uname -s" comamnd.  Note that the result would have to be 
unmarshalled to obtain the operating system name from the command's stdout 
data.

Instead of using the STAF command line executable as I showed in the 
examples above, you can submit STAF service requests via a Perl program 
using STAF Perl APIs.  If you want to submit STAF service requests like 
these via a Perl program, I suggest that you use the STAF Perl APIs 
instead of the system() command.  See the STAF Perl User's Guide  at 
http://staf.sourceforge.net/current/STAFPerl.htm for more information and 
examples of how to register with STAF to create a STAF handle and then use 
the STAF handle to submit STAF service requests.

STAF also provides APIs for Java, Python, and Tcl and there are STAF User 
Guides for them that are accessible via 
http://staf.sourceforge.net/docs.php.

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




yakov vilenchik <vko...@gmail.com> 
10/29/2009 03:51 PM

To
staf-users@lists.sourceforge.net
cc

Subject
[staf-users] Ho to receive






Hi All.

I want to get target machine OS type by running following perl/staf 
command: $ostype=system("staf process start command uname -s");
This command return "0" or other value as task result.
Is there way to get OS type (linux, windows...) as the result of this 
command?

Thanks in advanced, Yakov. 
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to