There is no START service. There is a PROCESS service and you can use its START request to start a process.
Here's an example of a C++ program that submits a START request to the
PROCESS service (without the WAIT option) and prints the handle# for the
process it started:
#include "STAF.h"
#include "STAF_iostream.h"
#include "STAFString.h"
int main(int argc, char **argv)
{
STAFHandlePtr handlePtr;
unsigned int rc = 0;
STAFString handleName = "MyHandle";
rc = STAFHandle::create(handleName, handlePtr);
if (rc != 0)
{
cout << "Error registering with STAF, RC: " << rc << endl;
return rc;
}
cout << "Using handle number " << handlePtr->getHandle()
<< " with handle name \"" << handleName << "\"" << endl << endl;
// Set the machine and command to whatever you want
STAFString machine = "local";
STAFString command = "echo Hello";
STAFString request = "START SHELL COMMAND " +
STAFHandle::wrapData(command);
cout << "STAF " << machine << " PROCESS " << request << endl;
STAFResultPtr res = handlePtr->submit(machine, "PROCESS", request);
if (res->rc != kSTAFOk)
{
cout << "STAF " << machine << " PROCESS " << request << " failed
with RC="
<< STAFString(res->rc)
<< " Result=" << res->result << endl;
return res->rc;
}
cout << "Result (the STAF handle for the process): " << res->result <<
endl << endl;
return 0;
}
Here's sample output from running this C++ program where it started a
process with STAF handle # 809:
C:\tests>testprocess
Using handle number 808 with handle name "MyHandle"
STAF local PROCESS START SHELL COMMAND :10:echo Hello
Result (the STAF handle for the process): 809
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [email protected]
(512) 286-7313 or Tieline 363-7313
From: "Dedhia, Hardik" <[email protected]>
To: Sharon Lucas/Austin/IBM@IBMUS
Date: 07/06/2011 03:12 PM
Subject: RE: regarding STAF PROCESS START
I’m using the START service from a program using the handle->submit.
In this case I am having trouble in locating the string that contains the
handle number.
If you could point me to where the string is being returned it’ll be
great.
Thanks,
Hardik.
From: Sharon Lucas [mailto:[email protected]]
Sent: Wednesday, July 06, 2011 4:05 PM
To: Dedhia, Hardik
Cc: [email protected]
Subject: Re: regarding STAF PROCESS START
A PROCESS START request without the WAIT option specified returns the STAF
handle number of the process started in the STAF result. For example:
C:\>STAF client1.company.com PROCESS START SHELL COMMAND "/test/test1.sh"
Response
--------
806
The result, 806, is a string containing the STAF handle number for the
process on machine client1.company.com.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [email protected]
(512) 286-7313 or Tieline 363-7313
From: "Dedhia, Hardik" <[email protected]>
To: <[email protected]>, Sharon
Lucas/Austin/IBM@IBMUS
Date: 07/06/2011 02:57 PM
Subject: regarding STAF PROCESS START
Hi,
I am trying to use the staf Process Start service to start a program on a
remote client. I wish to save the handle number which is returned, but,
I’m facing some problems.
Could you please help me to retrieve the handle number so I can use this
to further communicate with that process.
Thanks,
Hardik.
<<image/gif>>
------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________ staf-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/staf-users
