ESP Workload Automation

 View Only
  • 1.  Error not raised o shell scripts

    Posted Nov 09, 2020 12:51 PM
    Hi,
    He hace an issue with a shell sript on al linux (red hat 7) server. 
    The shell (bash) has error controls and when have any error do a exit 1, but the ESP Agent is allways sending exit 0 ,
    Any idea about what could be the issue?

    Regards


  • 2.  RE: Error not raised o shell scripts

    Posted Nov 09, 2020 01:25 PM

    The ESP Agent passes the script exit status back to the scheduling manager(ESP), it does not modify the value

    It is my belief that the script is NOT exiting with zero.

    To check the agent is working as expected, create an ESP job:

    LINUX_JOB NIXCMD
      AGENT %USER1
      CMDNAME /bin/bash
      USER <Valid User>
      ARGS -c 'exit %USER2'
      RUN ANYDAY
    ENDJOB

    Trigger job with the agent name for USER1 and a numeric value(Exit Status) for USER2.

    If you trigger it with USER2 = 1, does it show up as failed?

    If Yes, agent is working as expected and issue is with the script.



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 3.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 01:50 AM
    Hi,
    We had created an test shell in order to be sure that the issue is nor regarding de shell logic.

    The shell only exit with the parameter received
    #!/bin/bash
    NOM_JOB=$1
    echo "Parametreo $NOM_JOB"
    exit $NOM_JOB

    The job configuration:
    .....
    SCRIPTNAME /path/test.sh
    ARGS 1

    But the agent show complete sucessfully

    transmitter.log:

    11/11/2020 17:58:13.339 PET-0500 2 TCP/IP Controller Plugin.Transmitter pool thread <Regular:2>.CybTargetHandlerChannel.call[:695] - Message has been sent: 20201111 17581333+0500 ESP11MPC pmisflnxd01 $P8MFPRU.RG/AAINSERT.2570/MAIN State COMPLETE Cmpc(0) SetEnd JobLogId(E7FB65B9A6384C12BD5481F1F3CB52CAA3EAF0E0)  User(pmisflnxd01) Host(pmisflnxd01)

    11/11/2020 17:58:47.738 PET-0500 2 TCP/IP Controller Plugin.Transmitter pool thread <Regular:1>.CybTargetHandlerChannel.call[:695] - Message has been sent: 20201111 17584772+0500 ESP11MPC pmisflnxd01 D8CED05A.CE82DAC6/A/QUERY RESPONSE SPOOLFILE Data("----------------------------------------------------------------Output of messages for workload object $P8MFPRU.RG/AAINSERT.2570/MAINStart date Wed Nov 11 17:58:09 2020----------------------------------------------------------------Parametreo 1") FileSize(249) Lengths(64 69 35 64 12 ) DataStatus(EOF)  Plugin(runner) User(pmisflnxd01) Host(pmisflnxd01)




  • 4.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 08:16 AM

    I created a shell script with you test script and added debug on command interpreter

    #!/bin/bash -x
    NOM_JOB=$1
    echo "Parametreo $NOM_JOB"
    exit $NOM_JOB

    CSF
    Job Name Agent Name ApplName Gen# CCode Job Status
    ___ TESTJOB LJ_LINUX64 CHKAGENT 15761 1 FAILED, CC 1 AT 08.48 12


    WSF
    ----------------------------------------------------------------
    Output of messages for workload object CHECKJOB/CHKAGENT.15761/MAIN
    Start date Thu Nov 12 08:48:07 2020
    ----------------------------------------------------------------
    + NOM_JOB=1
    + echo 'Parametreo 1'
    Parametreo 1
    + exit 1

    Can you add the -x debug, rerun and post WSF output?

    Can you also post incoming message from receiver.log?

    Thanks



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 5.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 11:47 AM
    Hi,
    I'd added +x into the script.

    The output :

    $P8MFPRU PMISFLNX 2570 AAINSERT COMPLETED AT 11.18 12 NOV

    LOG

    ---------------------------------- TOP OF DATA---------------------------------
    ----------------------------------------------------------------
    Output of messages for workload object $P8MFPRU.RG/AAINSERT.2570/MAIN
    Start date Wed Nov 11 17:58:09 2020
    ----------------------------------------------------------------
    Parametreo 1
    ----------------------------------------------------------------
    Output of messages for workload object $P8MFPRU.RG/AAINSERT.2570/MAIN
    Start date Thu Nov 12 11:17:52 2020
    ----------------------------------------------------------------
    + [ -x /usr/bin/id ]
    + [ -z '' ]
    + id -u
    + EUID=1166
    + id -ru
    + UID=1166
    + id -un
    + USER=oracle
    + LOGNAME=oracle
    + /bin/bash /u01/cubo/bin/test.sh 1
    Parametreo 1
    + on_exit
    + 2> /dev/null

    Receiver.log:
    11/12/2020 11:17:52.390 PET-0500 5 TCP/IP Controller Plugin.Receiver pool thread <Regular:2>.CybReceiverSession.accept[:219] - Message accepted: 20201112 11175244+0500 PMISFLNXD01 ESP11MPC $P8MFPRU.RG/AAINSERT.2570/MAIN RUN . Data(Script=/u01/cubo/bin/test.sh,ExitCode=(1-4095,f),Args="1") TargetSubsystem(UNX) User(oracle) MFUser(SCHDFLT)
    11/12/2020 11:17:52.395 PET-0500 2 TCP/IP Controller Plugin.Receiver pool thread <Regular:2>.CybReceiverSession.accept[:226] - Message received: 20201112 11175244+0500 PMISFLNXD01 ESP11MPC $P8MFPRU.RG/AAINSERT.2570/MAIN RUN . Data(Script=/u01/cubo/bin/test.sh,ExitCode=(1-4095,f),Args="1") TargetSubsystem(UNX) User(oracle) MFUser(SCHDFLT)
    11/12/2020 11:17:52.404 PET-0500 2 TCP/IP Controller Plugin.Receiver pool thread <Regular:2>.CybReceiverChannel.receive[:252] - Exiting conversation
    11/12/2020 11:18:28.146 PET-0500 2 TCP/IP Controller Plugin.Receiver pool thread <Regular:1>.CybReceiverChannel.receive[:157] - Conversation from 192.168.254.21:59510 to 10.80.197.253:7520 arrived
    11/12/2020 11:18:28.147 PET-0500 5 TCP/IP Controller Plugin.Receiver pool thread <Regular:1>.CybReceiverSession.accept[:219] - Message accepted: 20201112 11182819+0500 PMISFLNXD01 ESP11MPC D8CFB8BD.968E7EC6/A/QUERY CONTROL GETSPOOLFILE Jobid($P8MFPRU.RG/AAINSERT.2570/MAIN) BoundaryFormat(LINE) LastMatch(FALSE) TargetSubsystem(UNX) StartOffset(0) MFUser(S22146) User(S22146)
    11/12/2020 11:18:28.148 PET-0500 2 TCP/IP Controller Plugin.Receiver pool thread <Regular:1>.CybReceiverSession.accept[:226] - Message received: 20201112 11182819+0500 PMISFLNXD01 ESP11MPC D8CFB8BD.968E7EC6/A/QUERY CONTROL GETSPOOLFILE Jobid($P8MFPRU.RG/AAINSERT.2570/MAIN) BoundaryFormat(LINE) LastMatch(FALSE) TargetSubsystem(UNX) StartOffset(0) MFUser(S22146) User(S22146)
    11/12/2020 11:18:28.150 PET-0500 2 TCP/IP Controller Plugin.Receiver pool thread <Regular:1>.CybReceiverChannel.receive[:252] - Exiting conversation

    Thanks in advance


  • 6.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 02:16 PM

    In my test with your script the script exits with 1 and I see it in the job output and its detected by ESP
    + NOM_JOB=1
    + echo 'Parametreo 1'
    Parametreo 1
    + exit 1

    In your script the variable is set to 1 
    Parametreo 1
    + on_exit
    + 2> /dev/null

    But it does not show the "+ exit 1" command.

    What does "on_exit" do?

    The command "+ 2> /dev/null" hides errors, might help to comment that line out



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 7.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 11:58 AM

    I am unable to reproduce the behavior you have.

    If you run the script from the command line outside of ESP and pass a 1 for parameter 1.

    Does the script exit with zero?

    To display exit status enter "echo $?" right after the script exits.

    Does it display 1 or 0?



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 8.  RE: Error not raised o shell scripts

    Posted Nov 12, 2020 12:06 PM
    Hi,
    If I execute directly on the server the shell exits with 1:
    $./test.sh 1
    + NOM_JOB=1
    + echo 'Parametreo 1'
    Parametreo 1
    + exit 1
    /u01/cubo/bin
    $echo $?
    1