Note that the shell tries to de-reference any environment variables you specify via $VarName so that's why the environment variable is being resolved on the system where you are submitting the STAF service request. Instead, use a STAF variable. STAF provides a STAF variable for each environment variable that exists when STAFProc is started named STAF/Env/<VarName>. So you can specify this as {STAF/Env/GLASSFISH_HOME} in your STAF service request. Note that "{" denotes a STAF variable reference. Most STAF service options support resolving STAF variables (as documented in the STAF User's Guide). For example:
su - root -c "/usr/local/staf/bin/STAF $SUT_PRI PROCESS START SHELL COMMAND \" # service maf-tds stop su - mafadmin asadmin stop-cluster --user admin --passwordfile {STAF/Env/GLASSFISH_HOME}/passwords.txt cluster1 # asadmin stop-domain domain1 # asadmin stop-node-agent agent_PRIM0 \" WAIT STDERRTOSTDOUT STDOUT /tmp/stop_primary_server_activity.log" 2>&1 > /dev/null #--> end staf cmd -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: "Bridges, Michael" <michael.brid...@acision.com> To: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net> Date: 08/09/2010 10:13 AM Subject: [staf-users] How to reference env variables on staf client system Hi all – I am using STAF inside BASH scripts with RHEL5 to control the the automated installation of software I need to regression test nightly. On the target test system, the STAF is running. From my staf-mgmt system, I need to execute a command on the remote client system that contains a reference to an environment variable on the remote system that is NOT set on the mgmt client. As an example, here is the bash script code that I need to run on the remote server to stop some applications. Notice the global env var $GLASSFISH_HOME in the asadmin command inside the PROCESS command stack. This does not get de-referenced on the remote system as the var $GLASSFISH_HOME is not set on my staf mgmt system. #--> staf cmd su - root -c "/usr/local/staf/bin/STAF $SUT_PRI PROCESS START SHELL COMMAND \" # service maf-tds stop su - mafadmin asadmin stop-cluster --user admin --passwordfile $GLASSFISH_HOME/passwords.txt cluster1 # asadmin stop-domain domain1 # asadmin stop-node-agent agent_PRIM0 \" WAIT STDERRTOSTDOUT STDOUT /tmp/stop_primary_server_activity.log" 2>&1 > /dev/null #--> end staf cmd I have tried escaping it as follows: #--> staf cmd su - root -c "/usr/local/staf/bin/STAF $SUT_PRI PROCESS START SHELL COMMAND \" # service maf-tds stop su - mafadmin asadmin stop-cluster --user admin --passwordfile \$GLASSFISH_HOME/passwords.txt cluster1 # asadmin stop-domain domain1 # asadmin stop-node-agent agent_PRIM0 \" WAIT STDERRTOSTDOUT STDOUT /tmp/stop_primary_server_activity.log" 2>&1 > /dev/null #--> end staf cmd but that doesn’t seem to work either. What am I missing? Thanks for any help Mike This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users