BSA: NSH script job ends with Exit Code 13 or 141[1]

Version 1

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    BladeLogic Server Automation Suite


    BMC BladeLogic Server Automation Suite



    BMC BladeLogic Server Automation (BSA) NSH script job ends with Exit Code 13 or 141





    Essentially, the exit code 13 means "broken pipe."  In cases when the NSH script exits normally with "exit code 0", but the script job exits with "exit code 13", it appears that the target server encounters an error closing down a remote connection during the cleanup from exiting the script to returning the job result to the appserver. This error code is then returned as the job result.

    Adding the disconnect statement to the script at the right point causes the target server to close down remote connections before exiting the script. At this point even if exit code 13 is encountered there is nothing to consume that error. The script then runs to successful completion, and exit code 0 is always returned both as the script result and the job result.

    The exit code 13 after the script has completed is essentially benign. It indicates that the target server encountered a broken pipe while it was closing a remote connection *after* completing the NSH script being run by the script job. This exit code is returned as the job result, but it essentially is meaningless. The disconnect statement is a good way to suppress this error.


    Exit Code 141 is a combination of errors 128 and 13 which gives you 141 where:Workaround/Solution


    cd //@


    Additional Notes:

    The Network Shell dynamically creates network connections to the remote hosts that it accesses. For efficiency
    reasons, these connections remain open until the user exits the shell or executes the disconnect command.
    This command closes the network connections of the hosts given to it as arguments. If no arguments
    are given, the shell closes all connections. The network connection to the host on which the current directory
    exists is not closed even if specifically asked to do so.
    If the Network Shell again needs access to a remote host, then a new dynamic network connection is created.
    The Network Shell utilities manage their own network connections and do not affect the shell.
    To ensure that you do not exhaust system resources, it is a good idea to call the disconnect command occasionally,
    especially if you are accessing large numbers of remote hosts. When accessing relatively few
    remote hosts, calling the disconnect command is not required.

    You need to do a
    cd //@
    before the disconnect, otherwise the disconnect won't work, since you are still under the context of the target.

    PAR-LJOURDAI-01% cd //eurrh4vm2
    eurrh4vm2% disconnect
    eurrh4vm2% cd //@
    PAR-LJOURDAI-01% disconnect
    Disconnecting from eurrh4vm2 ...done

    Related Products:  
    1. BMC BladeLogic Server Automation Suite


    Article Number:


    Article Type:

    Solutions to a Product Problem

      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles