First, setting a value for a STAF variable does not require STAF trust
level 5. It only requires trust level 3 (the default STAF trust level).
You don't need to submit a request to the STAF PROCESS service on machine
Consumer to set a STAF variable. Instead, submit the SET request directly
to the VAR service on machine Consumer. For example:
STAF Consumer VAR SET SHARED VAR TEST=Value
It would be better if you used Python, Perl, Tcl, Java, or C++ to submit
STAF service requests as STAF provides APIs for all of these languages
including the ability to unmarshall the result from a STAF service request
and these languages have more functionality than a shell script and
certainly more than a .bat file.
Via a shell script you can use the STAF command executable (STAF.exe) to
submit STAF service requests, but you won't have any APIs to unmarshall a
multi-value result. A Windows .bat file allows you to run a STAF command
but .bat file is very primitive and doesn't lets you assign a variable to
the result so I don't think you can use a Windows .bat file. If you have
CygWin installed on your Windows machines you could use it to run a shell
script on Windows instead. If you really want to submit STAF service
requests via a shell script, you could do it as described in subsection
"Using the STAF command from shell-scripts" within section "5.2 STAF' in
the STAF User's Guide at
http://staf.sourceforge.net/current/STAFUG.htm#HDRSTAFSHS. For example,
you could run a shell script like the folllowing on Consumer to get the
value of the {TEST} variable on Administrator, set it, and use log a
message with its value:
#!/bin/sh
export STAF_QUIET_MODE=1
echo "Starting test";
STAFResult=`STAF Administrator VAR GET SHARED VAR TEST`;
RC=$?;
varValue=$STAFResult;
if [ $RC -ne 0 ]; then
echo "STAF Administrator VAR GET request failed, RC: $RC, Result:
$STAFResult"
return $RC;
fi
echo "The value of shared TEST variable on Administrator is: $varValue"
STAFResult=`STAF local VAR SET SHARED VAR "TEST=$varValue"`
RC=$?
if [ $RC -ne 0 ]; then
echo "STAF local VAR request failed, RC: $RC, Result: $STAFResult"
return $RC;
fi
STAFResult=`STAF local LOG LOG GLOBAL LOGNAME sampleLogname LEVEL INFO
MESSAGE "Variable shared: {TEST}"`;
RC=$?;
# Note that you could specify $varValue instead of {TEST} in the above
request with the same result;
if [ $RC -ne 0 ]; then
echo "STAF local LOG request failed, RC: $RC, Result: $STAFResult"
return $RC;
fi
exit 0;
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Zach Calvert <zachcalv...@gmail.com>
To: Sharon Lucas/Austin/IBM@IBMUS
Date: 03/07/2011 01:53 PM
Subject: Re: [staf-users] Variable Sharing
I really want to set the same value on another system.
I've written automated scripts, both in bat form for windows and sh
form for linux. I set a local variable where I want all logs sent to.
I want this exact same variable name and value to be distributed to
all of the machines involved in this automation process. How is this
achievable? In other words, I want the same behavior as STAF Consumer
PROCESS START SHELL COMMAND "STAF LOCAL VAR SET SHARED VAR
TEST={TEST}" without having to have level 5 admin access.
Perhaps I'm not understanding how to consume the response from running
the command STAF Administrator VAR RESOLVE SHARED VAR {TEST}. For
example, how could I now use the variable TEST on the Consumer machine
to be resolved in a log. ie command run from the Consumer machine:
STAF Administrator LOG LOG GLOBAL LOGNAME sampleLogname LEVEL INFO
MESSAGE Variable shared: {TEST}
and I want that log to read "Variable shared: hello"
Thanks,
Zach
On Mon, Mar 7, 2011 at 1:07 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
> To set a STAF environment variable you must set it via the VAR service's
SET
> request (or you can set a variable in the STAF.cfg file).
>
> Do you really want to create the same STAF variable on another system?
> Perhaps you really just want to set the variable on one system and
access
> it from any system.
>
> For example, on machine Administrator:
>
> STAF local VAR SET SHARED VAR TEST=hello
>
> On machine Consumer, it can get the value of this variable:
>
> STAF Administrator VAR RESOLVE SHARED VAR {TEST}
> Response
> --------
> Hello
>
> And if machine Administrator gives machine Consumer trust level 3 or
greater
> (note that 3 is the default trust level unless you overrode it), it can
> change the value of the variable on Administrator:
>
> STAF Administrator VAR SET VAR "Test=New Value"
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin, luc...@us.ibm.com
> (512) 286-7313 or Tieline 363-7313
>
>
>
>
> From: Zach Calvert <zachcalv...@gmail.com>
> To: staf-users@lists.sourceforge.net
> Date: 03/07/2011 12:53 PM
> Subject: [staf-users] Variable Sharing
> ________________________________
>
>
> I have two machines, call them Administrator and Consumer. On
> Administrator I define a variable called TEST with value hello using
> the command
> STAF LOCAL VAR SET SHARED VAR TEST=hello
> I am trying to get Consumer to have the same value for TEST defined in
> the same variable for Consumer. For example, I want STAF LOCAL VAR
> LIST to display a variable with TEST: hello
>
> The only way that I know of to share the variable is through having
> Administrator call out
> STAF Consumer PROCESS START SHELL COMMAND "STAF LOCAL VAR SET SHARED
> VAR TEST={TEST}"
> and Administrator must have level 5 administrator access defined on
> Consumer.
>
>
>
>
> Is there an easier way to get a STAF variable off of one machine and
> store it onto another?
>
>
>
>
> Thanks,
> Zach Calvert
>
>
------------------------------------------------------------------------------
> What You Don't Know About Data Connectivity CAN Hurt You
> This paper provides an overview of data connectivity, details
> its effect on application quality, and explores various alternative
> solutions. http://p.sf.net/sfu/progress-d2d
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
>
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users