You are not specifying the PROCESS START request properly. It is PARMS not 
PARAMS and since the parms contains a space, you must either enclose the 
parms value in double quotes or use the ColonLengthColon format which  you 
can do by using the STAF::WrapData function as talked about in section 
"7.2 Option Value Formats" in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM.  Better yet, 
when you specify the SHELL option you can specify the command and 
parameters in the command value.  Also, since you're submitting the 
request synchronously by specifying the kReqSync option using the submit2 
method, you might as well use the submit API instead as it is equivalent. 
Here's an example (note this example is very similar to an example in the 
STAF Perl User's Guide at http://staf.sourceforge.net/current/STAFPerl.htm
.

# Register with STAF and get a STAF handle

$handle = STAF::STAFHandle->new("MyProcessTest"); 

if ($handle->{rc} != $STAF::kOk) { 
    print "Error registering with STAF, RC: $handle->{rc}\n"; 
    exit $handle->{rc};
} 

# Submit a PROCESS START request and wait for it to complete

my $machine = "local";
my $command = "/bin/rpm -q AvmarClient";
my $request = "START SHELL COMMAND ".STAF::WrapData($command).
              " RETURNSTDOUT RETURNSTDERR WAIT";

print "\nSTAF $machine PROCESS $request\n";

my $result = $handle->submit($machine, "PROCESS", $request);

if ($result->{rc} != $STAF::kOk) {
    print "Error on STAF $machine PROCESS $request\n";
    print "Expected RC: 0\n";
    print "Received RC: $result->{rc}, Result: $result->{result}\n";
    exit $result->{rc}; 
}

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




From:   <sanjeev.lohc...@emc.com>
To:     <staf-users@lists.sourceforge.net>
Date:   04/15/2011 05:46 AM
Subject:        [staf-users] How to pass prams to process request using 
submit2



Hi,

I am automating the linux and AIX package installation process.

Using Perl API I am using the following command:

$cmdResult = $fHandle->submit2($STAF::STAFHandle::kReqSync,"$machineName", 
"process", "start command /bin/rpm params -q AvmarClient returnstdout 
returnstderr wait");

But it fails with error:

Invalid command: /bin/rpm -q AvamarClient-6.0.100-580
The command is not a file or does not have execute permissions.
OS RC 2

But same thing if I am executing:

staf local process start command /bin/rpm parms "-q AvamarClient" 
returnstdout retrunstderr wait

it works fine.  I would like to know how could we pass the parms option 
using submit2 call.

Regards
Sanjeev

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 

application availability and disaster protection. Learn more about 
boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to