Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    OT - running shell script displays an error message while it should not

    Scheduled Pinned Locked Moved Support
    linuxotter
    3 Posts 2 Posters 11 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by

      Hello

      I have a shell script, which clone a git repo and run few command.
      Directly from the server, it is working properly.

      From Otter, as SHCall, it reports ERROR while is it just echo or result of the command line.
      Results below of a small script shell

      echo ==>  install-monitor sur $(hostname)
      git clone https://oauth:********@********/monitor.git /opt/monitor
      
      DEBUG: 2023-07-17 11:54:18Z - Job will be run against servers sequentially (not asynchronously).
      DEBUG: 2023-07-17 11:54:18Z - Targeting servers: VMXXXXXX
      DEBUG: 2023-07-17 11:54:18Z - Beginning execution run...
      INFO : 2023-07-17 11:54:19Z - ==> install-monitor sur VMXXXXXX
      ERROR: 2023-07-17 11:54:20Z - Cloning into '/opt/monitor'...
      

      How to avoid such behaviour and keep real ERROR

      I have plenty of working shell scripts I have to run through Otter

      Best regards
      Philippe

      Running : Otter Version 2022.11 / docker

      atrippA 1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer @philippe.camelio_3885
        last edited by

        Hi @philippe-camelio_3885 ,

        When text is written to the stderr stream, Otter will interpret this as an error. Unfortunately a few tools (including git) like to write to the stderr, even though it's not an error, and will use the exit code to indicate an error instead.

        There are a handful of ways to deal with this:

        • set ErrorOutputLogLevel in the SHExec operation
        • use try/catch/force normal in OtterScript
        • modify your script to redirect output

        Redirecting is strongly recommended, and you can do it with 2>&1 in your script. Then you can test the exit code of the tool, and write to the error stream so Otter can pick it up as an error.

        Cheers,
        Alana

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885 @atripp
          last edited by

          Hi @atripp
          Thanks for the tips.

          Best regards

          Philippe

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post
          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation