7 Replies Latest reply on Nov 9, 2011 8:31 AM by Raj NameToUpdate

    How to redirect BBSA Job logs to a text file

      Hi,

       

      I see the success result in the Job logs that all required server got licensed. (test : Licensed for NSH/CM) , but can I redirect the script logs to any text file somewhere and would send that result in the email?

       

      -Raj

       

       

        • 1. Re: How to redirect BBSA Job logs to a text file

          You can export the job logs in csv/html form and save it to disk. Is that what we are looking for?

          1 of 1 people found this helpful
          • 2. How to redirect BBSA Job logs to a text file

            Thanks for your reply, but I am looking something else like in my environment i receive e-mail if any job get success / failure , but i do not receive the Job result / logs into that e-mail. As i mentioned for instance i run Auto Lic script Job I got e-mail that job completed successfully , but i did not receive the logs which servers got license or not but i have to go to Job result / logs then i only i came to know which servers get success / failure. So my idea is there any way that we redirect those Job Logs automatically to some location on the disk / e-mail so that i should not go to Job logs and have to check the results.

             

            Is that make any sense? Or you need some more input from my side.

             

            Thanks

            -Raj

            • 3. Re: How to redirect BBSA Job logs to a text file
              Bill Robinson

              you would need to run your job from inside another nsh script job, and have the wrapper job export the log and email it.  i wrote a script to do this.  you can comment out the 1st 2 lines to run this as a job.  you must pass in some arguments - i think those are self-explainatory.  this is a type 2 nsh job that does not need a target server.

               

              you should also call bmc support and file an enhancement request for this.

               

              ---------------------------------------

              #!/bin/nsh


              blcli_setoption serviceProfileName defaultProfile
              blcli_setoption roleName BLAdmins

              blcli_connect

              jobType="${1}"
              jobFolder="${2}"
              jobName="${3}"
              notifyType="${4}"
              contact1="${5}"
              contact2="${6}"

              emailFrom="${USER}@`uname -n`"
              blcli_execute ${jobType} getDBKeyByGroupAndName "${jobFolder}" "${jobName}"
              blcli_storeenv jobKey
              blcli_execute ${jobType} executeJobAndWait "${jobKey}"
              blcli_storeenv jobRunKey
              blcli_execute JobRun getStartTimeByRunKey "${jobRunKey}" "yyyyMMddHHmmss"
              blcli_storeenv runTime

               

              if [ "${jobType}" = "DeployJob" ]
                      then
                      blcli_execute Utility exportDeployResults "${jobKey}" "${jobRunKey}" "/tmp/${jobName}_${runTime}.csv"
              elif [ "${jobType}" = "NSHScriptJob" ]
                      then
                      blcli_execute Utility exportNSHScriptResults "${jobRunKey}" "/tmp/${jobName}_${runTime}.csv"
              else
                      echo "[ERROR] Job type: ${jobType} not supported"
                      exit 1
              fi

              if [ "${notifyType}" = "email" ]
                      then
                      blcli_execute Email sendMailWithAttachment "${emailFrom}" "${contact1}" "${jobName} ${runTime} Detail Log" "${jobName} ${runTime} Detail Log" "/tmp" "${jobName}_${runTime}.csv"
                      rm -f "/tmp/${jobName}_${runTime}.csv"
              elif [ "${notifyType}" = "file" ]
                      then
                      [ ! -d "//${contact1}${contact2}" ] && mkdir -p "//${contact1}${contact2}"
                      mv "/tmp/${jobName}_${runTime}.csv" "//${contact1}${contact2}"
              else
                      echo "[ERROR] Notify Type: ${notifyType} not supported"
                      exit 1
              fi

              ------------------------

              1 of 1 people found this helpful
              • 4. How to redirect BBSA Job logs to a text file

                Thanks i will test this script and come back if in case of issue.

                 

                Thanks for your help.

                 

                -Raj

                • 5. How to redirect BBSA Job logs to a text file

                  I have some queries for this script.

                   

                  Why we use blcli_connect? ( This command initiates the connection to the Application Server ), but i never use this in most of my script?

                   

                  Why we use blcli_execute? ( This command executes a BLCLI call against the Application Server), but i usually run all my script with blcli option only?

                   

                  Sorry for my simple questions?

                   

                  -Raj

                  • 6. Re: How to redirect BBSA Job logs to a text file
                    Bill Robinson

                    The blcli_* are the ‘performance commands’.

                     

                    The normal blcli will open a jvm, authenticate, run the command, and close the jvm.  It will do that every time the blcli command is called. This is very expensive and results in very poor runtimes if you are running many commands in sequence. The ‘performance commands’ open the jvm once and let you run many commands and script logic.  This is much faster.

                     

                    Technically the blcli_connect is not needed – the first blcli_execute will take care of the connect if we are not connected yet.

                     

                    There is a section on the commands in the blcli help – ‘nsh performance commands’

                    • 7. How to redirect BBSA Job logs to a text file

                      Thanks for your great help! Now I got the exact idea