4 Replies Latest reply on Jan 30, 2014 12:30 PM by Spike White

    How to set timeouts for bladelogic nsh job?

      I wanted to see if there were any built in timeouts I could add to my bladelogic nsh script for scenarios where a command hangs. I've searched the message board and wasn't able to find documenation for timeout values and how to set them.

       

      Thanks,

       

      Rob

        • 1. Re: How to set timeouts for bladelogic nsh job?
          Siddu angadi

          Hi Jordan,

           

          Look at the JOB_TIMEOUT property of NSHScript job, this is basically specifies a maximum period of time, in minutes, for the job to complete. If the job exceeds this maximum, the system automatically cancels the job.

           

          This Property located at left down corner and expand the extended property of NSHScript Job.

           

          Thanks

          Siddu

          1 of 1 people found this helpful
          • 2. Re: How to set timeouts for bladelogic nsh job?
            Bill Robinson

            you can set this on the job level, but not easily at the command execution level. 

            1 of 1 people found this helpful
            • 3. Re: How to set timeouts for bladelogic nsh job?
              Siddu angadi

              Hi Rob,

               

              Is your question answered?

               

              Thanks

              Siddu

              • 4. Re: How to set timeouts for bladelogic nsh job?

                Bill,

                 

                I have a wrapper bash function with the same syntax as scriptutil, but implements timeouts on scriptutil.    So you'd call it in a NSH script as so:

                 

                # FQDN list comes from $* or via '%f'  (file on cmd line)

                while read FQDN

                do
                    # if $FQDN not pingable, don't even try
                   /bin/ping -q -w 3 -i 0.2 -c 3 $FQDN > /dev/null 2>&1

                   if [ $? -ne 0 ]
                   then

                      echo $FQDN not pingable

                   else  
                            scriptutil_with_job_part_timeout -h $FQDN -s $SCRIPT_NAME

                   fi

                done

                 

                So it does the equivalent (for NSH scripts) of what JOB_PART_TIMEOUT does for type 3 scripts.  I've tried to share this function, but apparently, it's too large.

                 

                Alternately, I've seen people write a "nanny" script to watch for hanging scriptutil invocations and kill that invocation.

                 

                So then your above NSH loop would look like:

                 

                while read FQDN

                do
                    # if $FQDN not pingable, don't even try
                   /bin/ping -q -w 3 -i 0.2 -c 3 $FQDN > /dev/null 2>&1

                   if [ $? -ne 0 ]
                   then

                      echo $FQDN not pingable

                   else  
                            scriptutil -h $FQDN -s $SCRIPT_NAME

                   fi

                done

                 

                That's easy to code, but then you have to set up Bladelogic job execution rules to ensure that both the original NSH script and the nanny script start on the same BBSA app server.

                 

                Will a batch job guarantee that all tasks in the batch job are launched on the same app server?  I don't know.

                 

                Spike

                 

                Spike