I am looking for documentation that provides the return codes when running cozsftp in batch. Specifically RCs that are higher than 0 and less than 9.
We are migrating away from another product and a Unix file not found resulted in a RC higher than 4. Co:Z SFTP uses RC=1 which is lower than expected.
Thanks.
Return codes
The Co:Z SFTP client uses the same exit codes as the OpenSSH client. They generally aren't too useful, but here they are:
"0" means that no errors occurred, or an error occurred in batch mode and the subcommand that had an error was prefixed with "-"
"1" means that a command or function had an error
"255" is used for fatal errors.
If you want to exit your shell script (say, in COZBATCH) with a different return code, then you can add something like this to your script:
"0" means that no errors occurred, or an error occurred in batch mode and the subcommand that had an error was prefixed with "-"
"1" means that a command or function had an error
"255" is used for fatal errors.
If you want to exit your shell script (say, in COZBATCH) with a different return code, then you can add something like this to your script:
Code: Select all
# add this at end if your script after the cozsftp command
# and its input sub-commands
rc=$?
if [[ $rc -ne 0 ]]; then
exit 8
fi
That is very helpful.
If a job uses multiple sub-commands then the RC is always captured appropriately, right?
For example:
If the first get receives a non-zero RC, the second get is not executed so the RC is always set for the last command executed.
get $remotefile1 //DD:FILE1
get $remotefile2 //DD:FILE2
EOB
RC=$?
if [ $RC -ne 0 ] ; then { exit 8; } fi
//
If a job uses multiple sub-commands then the RC is always captured appropriately, right?
For example:
If the first get receives a non-zero RC, the second get is not executed so the RC is always set for the last command executed.
get $remotefile1 //DD:FILE1
get $remotefile2 //DD:FILE2
EOB
RC=$?
if [ $RC -ne 0 ] ; then { exit 8; } fi
//