An AutoSys job is running a script that invokes the less command on a file. When the script is executed from the command line by the user, the less command works properly and produces the desired output. When the script is run as an AutoSys job, the less command receives a warning and does not produce the desired output. The warning reads...
"some_file_name" may be a binary file. See it anyway?
Release : 12.0
Component : Workload Automation System Agent
The LESSOPEN variable is not set within the job environment. This variable will allow the less command to proceed with a file that may contain more than plain text. If the variable is not set, the warning above will be displayed and the user must select 'y' to continue.
The LESSOPEN variable is normally set by default in most Linux login environments. It is set by /etc/system.d/less.sh, which gets run when /etc/profile is sourced by a login shell. However, since scripts run by the agent are not run within a login shell, /etc/profile is not sourced and the LESSOPEN variable is not set.
Take steps to make sure the LESSOPEN variable is set within the job environment to the same value to which it is set at the command line. There are a variety of methods you can choose from to accomplish this...
Include it in an envvars attribute for the job.
If the job has the profile attribute set, include the variable in that profile.
Set it in /etc/auto.profile on the agent machine if it exists. For agents installed by the AutoSys media with default compatibility settings, this file gets sourced by any command job that is run on the agent.
Add it to the <AGENT_HOME>/cybAgent script. This is not ideal as that script may get overwritten by a patch or upgrade.