It appears that the agent is capturing standard out in the job output where you don't see stdout when running the script from the shell. For example I have a small BASH script which when I run it from a shell prompt on the agent (Linux) I get no output unless there is an error. However when I use an OS job to call the script on the same agent the output shows every single line of the script except for comments.
For example the first three lines of my script are to set variables which I would not expect to see in the job output however they do show up. I also use printf to write an error message to stdout if a config file can't be sourced and when that happens the job shows the actual printf command in the output before it shows the string that gets printed. Both cases are shown in the example output below. When I execute the script from the shell myself I only get back this string "Failed to source the config file /apps/ctm/scripts/ctm/etc/inPlaceholderText.conf, exiting in error."
Basically all the lines that start with + appear in the job output but not when running the script from a shell prompt.
I suspect that your script is doing much the same thing but it must be looping lots of files/records or the like to generate job output that large.
+ source /apps/ctm/scripts/ctm/etc/inPlaceholderText.conf
/apps/ctm/scripts/ctm/bin//zip-unzip.sh: line 44: /apps/ctm/scripts/ctm/etc/inPlaceholderText.conf: No such file or directory
+ printf 'Failed to source the config file /apps/ctm/scripts/ctm/etc/inPlaceholderText.conf, exiting in error.'
Failed to source the config file /apps/ctm/scripts/ctm/etc/inPlaceholderText.conf, exiting in error.
+ exit 1
I am currently researching how to get the job output to not show everything as I need to pass a password in a command and obviously don't want the job output to show that. I have a feeling I will have to refactor my script to send the output of sensitive lines to /dev/null instead.
By default, the Unix agent is configured to use the "-x" flag for Bourne/Korn shell script. This will cause the shell to echo commands to the standard output before executing them.
To disable echo, you can use the CCM to update the flag to "n". You can change this property of the Unix agent using the CCM under the "Job Submission and Tracking" tab. Alternatively, you can run ctmunixcfg on the agent machine.
Thanks MunKeong Lee one could definitely set that flag for the agent for sure. Another option is to use "set +x" in the script itself to disable the trace/debug mode then use "set -x" later in the script when you want to re-enable trace. I think that you could also add "+x" on the shebang line to disable trace for the entire script which has the advantage of not affecting other scripts.
Jasvinder Singh I'd try this in your script to see if it resolves your issue of the enormous output volume.
You can disable the -x at the job level only, rather than agent level, by adding this variable to the job:
%%ECHO_SYSOUT and value of 'n'