Hi,
I want to run a unix script on a server that sets a variable based upon file content and sets an autoedit variables with this value, so ControlM can then execute subsequent jobs passing in the value.
The first and subsequent jobs are in different servers, neither of which is the ControlM server.
OK, after more digging, it seems ctmvar can be run on agent nodes and i believe so can LIBMEMSYM.
My plan is to get a Unix script to read a value from a file, edit a LIBMEMSYM value using sed and then possible specify LIBMEMSYM in an extra susequent job to read in the new value from this file ready for the following job to pass this value to the next script.
I have used the set tab to specify LIBMEMSYM but get the error..
LIBMEMSYM FILE /home/ascadm/nigelf/controlm/iobvar.txt NOT FOUND
I have also tried a PRECMD of /usr/local/ctmagent/ctm/exe/ctmvar -action set -var %%\NF3 -varexpr "300
and get the following error...
Var name 'CTMERRNF3' in -VAR invalid: it must begin with %%
Can anybody help me please,
thanks.
(ps ControlM is on a windows Server and all nodes are Unix).
set autodeit variables from unix node
Your problem stems from trying to use a script to set the value of the variable directly.
In Unix, the Control-M Server starts a Control-M Agent shell session on the target host, which then runs the actual script (in a child shell session), and captures the sysout and the return code.
Any variable values exported by the actual script from the child shell only make it to the Agent's shell session (the parent shell) - they do not get returned back to the Control-M environment itself.
The only things returned from the Agent session to Control-M Server is the return code of the script and the sysout.
You must manipulate the required global variable from the Set or Post-Proc tabs of the job definition itself. In this case I think you'll want to use the Post-Proc tab.
In Unix, the Control-M Server starts a Control-M Agent shell session on the target host, which then runs the actual script (in a child shell session), and captures the sysout and the return code.
Any variable values exported by the actual script from the child shell only make it to the Agent's shell session (the parent shell) - they do not get returned back to the Control-M environment itself.
The only things returned from the Agent session to Control-M Server is the return code of the script and the sysout.
You must manipulate the required global variable from the Set or Post-Proc tabs of the job definition itself. In this case I think you'll want to use the Post-Proc tab.
Darvedd,Any variable values exported by the actual script from the child shell only make it to the Agent's shell session (the parent shell) - they do not get returned back to the Control-M environment itself.
using the ctmvar utility is possible to set a variable from the script to controlm environment. An important functionality...
Is possible but consider that the file specified in the LIBMEMSYM must be on the CTM\server machine.My plan is to get a Unix script to read a value from a file, edit a LIBMEMSYM value using sed and then possible specify LIBMEMSYM in an extra susequent job to read in the new value from this file ready for the following job to pass this value to the next script.
I use this for local variables, for global variable the use of the ctmvar is more flexible.
I suggest also to manage global variables deleting at the end of the day that not used.