When executing a job thru Autosys that performs a sftp command, we noticed that the sftp submission log file name is getting truncated while running outside of Autosys it isn't.
Release : 11.4
Component : CA Workload Automation System Agent
The terminal setting (like stty) will apply to the processes that are running with terminal inputs.
So, when the script is run from console, settings are acting and hence the output length is more and the file name hasn't truncated.
But when we run the script from the scheduler, it runs it via demon process of agent which is not connected to any terminal as it is expected to be non interactive. So the terminal settings are not applying and sftp is using the default length (80+1 - 36), which is falling short for the mentioned file and file name getting truncated.
I ran the sample script using a crontab and can see the same behavior.
In the sample script provided, I could see that we can apply a work around as below, which is helping in resolving the problem:
Instead of
spawn sftp -oUserKnownHostsFile=/dev/null -ostricthostkeychecking=no [email protected]
we can run a script as below:
spawn launchsftp.sh
launchsftp.sh file content:
stty columns 186
sftp -oUserKnownHostsFile=/dev/null -ostricthostkeychecking=no [email protected]