10 Replies Latest reply on Oct 16, 2014 3:19 PM by Bill Robinson

    blcli_execute stderr redirection problem

      Hi,

       

      I'm running CM 7.6.0.204 on WinXP and have been using blcli_execute successfully for a while with the exception of I/O redirection. I've never been able to get it to redirect stderr (or stdout) to a file. Here's the error I'm trying to redirect:

       

      % blcli_execute BlPackage createEmptyPackage MYPACKAGE  test 2000455

      Command execution failed. com.bladelogic.mfw.util.BlAppServerException: A job with the name 'MYPACKAGE' already exists in this group.

      %

       

      When I redirect it a zero length file is created:

       

      % blcli_execute BlPackage createEmptyPackage MYPACKAGE  test 2000455 2>/tmp/err.txt

      %

      % ls -l /tmp/err.txt

      -rw-r--r--   1   me     mygrp        0 Sep 14 14:45 /tmp/err.txt

      %

       

      Oddly, If I then run the command again without redirection there is no output to the screen nor to the file (and timestamp unchanged):

       

      % blcli_execute BlPackage createEmptyPackage MYPACKAGE  test 2000455

      %

      % ls -l /tmp/err.txt

      -rw-r--r--   1   me     mygrp        0 Sep 14 14:45 /tmp/err.txt

      %

       

      To restore output to the screen I have to do this:

       

      % 2>&2

      %

      Then the error is displayed on the screen again, though the first time preceeded by a blank line:

       

      % blcli_execute BlPackage createEmptyPackage MYPACKAGE  test 2000455


      Command execution failed. com.bladelogic.mfw.util.BlAppServerException: A job with the name 'MYPACKAGE' already exists in this group.
      % blcli_execute BlPackage createEmptyPackage MYPACKAGE  test 2000455
      Command execution failed. com.bladelogic.mfw.util.BlAppServerException: A job with the name 'MYPACKAGE' already exists in this group.
      %

       

      Any thoughts on how to get redirection working?

       

      thanks

       

      SteveP