Automic Workload Automation

 View Only

Return code of command passed to Job Messenger?

  • 1.  Return code of command passed to Job Messenger?

    Posted 27 days ago
    Edited by Daryl Brown 27 days ago

    Hello all,

    I'm working on a job here where I need to include a password on the commandline, so I'm following the documentation under the GET_LOGIN entry that shows you're supposed to pass your command through the job messenger in order to decrypt your password on the fly:

    :SET &LOGIN# GET_ATT(LOGIN)
    :SET &LI#GET_LOGIN(&LOGIN#,SVN,SVN,LOGIN_INFO)
    :SET &PW#GET_LOGIN(&LOGIN#,SVN,SVN,PASSWORD)

    &UC_JOBMD CMD="&SVN_CMD# checkout ""&SVN_URI#"" ""&SVN_DIR#"" --username &LI# --password &PW#"

    What I just noticed, however, is that if the command you're passing fails, the return code ($? in unix) I get from the command still shows 0...which suggests I'm capturing the return code of the job messenger, and not the return code of the command it's executing.

    Now the documentation for job messenger mentions that there's a 'RET' parameter that can be assigned (??) to the Job Messenger, but there's no example on that page that shows me how to actually make use of that.  (It does reference that RET parameter as part of the TRAILVER.MVS include, but it's not clear to me how that would translate into what to add to my &UC_JOBMD call here.)

    So let's take a simplified example here (on linux):

    When I run ls -l ~/non_existent_file.txt, and then echo $?, I see a return code of 2 (because the file doesn't exist).

    How would I need to modify this command -- &UC_JOBMD CMD="ls -l ~/non_existent_file.txt" -- and/or the echo $? command that follows it -- so that I can capture that return code of 2?  Everything I've tried so far keeps throwing the "No such file or directory" output I expect, but I keep getting a return code of 0 rather than 2.

    Assuming someone else out there has figured out the trick for this, could you please enlighten me/us?  

    Thanks!  :)

    -- Daryl


    [Edit: I just found Job Messenger in the Unix Agent version 24.4.0+hf.3.build.1747989755151 has an issue with returning the return code that talks about this being a known issue with the 24.4.0 hf2 linux agent (and apparently the 24.4.1 hf1 linux agent I'm using).  Is there any workaround for this other than upgrading to 24.4.3?]
    -------------------------------------------