4 Replies Latest reply on Oct 7, 2009 7:54 AM by Bill Robinson

    custom command that executes on BL App Server against selected target?

    Matt Kreger

      I'd like to create a custom command so I can right click on a newly registered server and choose Custom Command -> License Agent.

      This would run the bllic command on the BladeLogic Application server with the server name I'm clicking on as an argument.

       

      Is this possible?  Help would be appreciated.  Alternatively, I guess I can create a job that licenses all currently unlicensed or temporarily licensed servers.  Can someone recommend a source of documentation for writing NSH scripts?  The BL docs (AFIK) only talk about NSH Script jobs.

       

      Thanks

        • 1. Re: custom command that executes on BL App Server against selected target?
          Bill Robinson

          I thought I left a licensing script for you in the lab install I worked on?

           

          If you want to run a script you should do something like:

          type-2 script- pass hosts as argument, add a parameter to the script called 'servers' w/ the input of %h, assuming bllic binary is in /usr/nsh/bin

          • 2. Re: custom command that executes on BL App Server against selected target?
            Matt Kreger

            I don't think you did. We only just got the bllic utility last week.

            • 3. Re: custom command that executes on BL App Server against selected target?
              Matt Kreger

              OK. Finally getting back around to this.  What is a type-2 script?

               

              Can anyone recommend a technical resource for help learning to write NSH scripts?

              • 4. Re: custom command that executes on BL App Server against selected target?
                Bill Robinson

                type 1 is 'execute against each host separtely'  - basically parallel execution

                type 2 is 'execute the script once, pass the host list as a variable' - serial execution

                type 3 is 'copy and execute' - for a non nsh script to run on the target system (shell scripts w/ no nsh, bat files, probably not vbs)

                type 4 is for running a perl script. typically one that uses the nsh perl module included w/ the product.

                 

                Beyond deciding what type to use for a particular task, writing the nsh script is the same as writing a shell script, except that instead of dealing w/ only files, you have the ability to treat your servers like files or directories.

                 

                to choose a type, you need to understand what you are doing and what's the most efficient way to do it.  let's say you need to look in a file, take part of it and assign it to a server property - that's probably going to work best as the type 1 because the actions against each system are independent of each other.  now lets say you want to take an entry from a file and dump them into a central csv file.  that would work better as a type 2, because w/ the type 1 you could overlap the file writes (all the gathers are coming back at once).  type 2 would loop through.  the type 2 scripts generally require some kind of for loop to process each of the systems.

                 

                nsh is based on zsh, only that many of the commands have been recompiled to work across servers.  zsh is similar to bash and sh, so a scripting text on one of those would serve you well for basic shell scripts.