1 Reply Latest reply on Jun 16, 2015 4:53 PM by Bill Robinson

    NSH script timeout setting

    Mike Reider

      Hi all, wondering if anyone knows a way to configure a timeout value for an NSH script thats run from a external server.


      We have a NSH script thats run from a Blade Console server (blcred), it authenticates the user and then parses a server group for each server and does a "nexec $server $command" for each server in the group.


      It works fine, except for some strange reason its hitting 1 server in a particular group and the entire screen gets frozen, it never times out or anything. We ran it against other server groups and it went OK, but the problem is that if it hits any 'bad' server that has connection or other kinds of issues, the entire script gets stuck and I have to kill the putty session.


      I was looking for some sort of a timeout value for NSH session but didnt see anything in the docs. Is there any way to force nsh script to move to next target if 1 of the targets is down or unreachable? Thanks.


      this is the nsh script (Bsa 8.5.1 patch 4)


      blcred cred -acquire -profile $PROFILE -username $bl_username

      blcli_setoption serviceProfileName $PROFILE

      blcli_setoption roleName BLAdmins



              echo "[DEBUG] Group Name: $groupname"

              echo "[DEBUG] Command:    $command"

              blcli_execute Server listServersInGroup "$groupname"

              blcli_storeenv SERVER_LIST

              echo "[DEBUG] Servers in $groupname: $SERVER_LIST"



             for eachServer in $SERVER_LIST


                      echo "=== HOST: $eachServer"

                      nexec $eachServer "$command"

                      sleep 1


        • 1. Re: NSH script timeout setting
          Bill Robinson

          Options for the secure file - BMC Server Automation 8.5 - BMC Documentation

          timeout=<secs>NSH clientSets the maximum number of seconds that a client waits when first contacting a remote server before giving up. The default value is 30 seconds. Without this option, the TCP protocol might continue to contact an offline or unavailable server for several minutes before finally giving up and reporting that a server is unavailable. This timeout mechanism is implemented within the BMC Server Automation code and does not in any way alter any system wide TCP parameters. If the operating system has an effective TCP timeout less than the value defined here, the OS value takes precedence.


          that may help if the problem is connecting to the server.  if it's stuck in the command execution you might want to nexec your command and have it write to a log file and then background it.  you can scrape the log to look for completion or look for the pid or something like that.  do that in a loop and exit the loop on completion or on a counter.