8 Replies Latest reply on Sep 2, 2014 9:27 PM by Bill Robinson

    How to copy an NSHScript to another folder via CLI?

      Hi All,

      I need to copy an NSHScript in one of the Depot sub-folder to other sub-folders, I tried to do this with following command but failed:

      # blcli_execute NSHScript copyNSHScript "DBKEY" "target folder" "target name"

      Unknown command : name space = 'NSHScript', command = 'copyNSHScript'.com.bladelogic.om.infra.cli.factory.CommandNotFoundException: R: Cannot find command : NSHScript, copyNSHScript

       

      Here is the version information:

      # version

      BladeLogic RSCD Agent 8.3.01.160 (Release) [Apr 24 2013 14:11:54]

      Copyright (C) 1996-2012 BladeLogic Inc.

      BladeLogic Network Shell 8.3.01.160 (Release) [Apr 24 2013 14:11:54]

      Copyright (C) 1996-2012 BladeLogic Inc.

       

      I have no idea why this does not work for me, but I really need such a command to simplify my daily work. Can anybody tell me how to do it? Thanks!

        • 1. Re: How to copy an NSHScript to another folder via CLI?

          Hi Neil,

           

          This works fine for me on 8.3 SP2.

           

          One thing I noticed in your script is that you have the DBKey in quotes.  Try removing the quotes and see what happens.  Remember, BladeLogic matches the command based on the signature of the parameters so is looking for:

           

               NSHScript.copyNSHScript string string string

           

          in your example.

           

          Hope this helps!

           

          God bless,

          -John.

          • 2. Re: How to copy an NSHScript to another folder via CLI?

            Hi Neil,

             

            Same Command worked on 8.3 sp3 167 build, I am setting up 8.3 sp1 160 build or 83sp1 GA build, I will update you on this.

             

            engoel5x64vms1# version

            BladeLogic RSCD Agent 8.3.03.167 (Release) [Aug 26 2014 04:24:19]

            Copyright (C) 1996-2012 BladeLogic Inc.

            BladeLogic Network Shell 8.3.03.167 (Release) [Aug 26 2014 04:24:19]

            Copyright (C) 1996-2012 BladeLogic Inc.

             

            engoel5x64vms1# blcred cred -acquire -profile myServiceProfile -username BLAdmin -password ''

            password:

            Authentication succeeded: acquired session credential

            engoel5x64vms1# blcli_setoption serviceProfileName myServiceProfile

            engoel5x64vms1# blcli_setoption roleName BLAdmins

             

            engoel5x64vms1# blcli_execute NSHScript getDBKeyByGroupAndName '/CE' '3flags.sh'

            DBKey:SDepotObjectModelKeyImpl:2-1-2001519

             

            engoel5x64vms1# blcli_execute NSHScript copyNSHScript 'DBKey:SDepotObjectModelKeyImpl:2-1-2001519' '/TargetSubFolder' 'copied3flags.sh'

            DBKey:SDepotObjectModelKeyImpl:6-1-2004559

             

            engoel5x64vms1#

            1 of 1 people found this helpful
            • 3. Re: How to copy an NSHScript to another folder via CLI?

              One other thought, Neil...

               

              Check in the NSH/br/xml/cli directory that you have the NSHScript-Additional.xml file.  Since this is a complex command, it will need to be defined in one of the XML files in that directory (it should be the one I mentioned) but if that file was missing for some reason (or otherwise inaccessible), you would see exactly the error message you listed.

               

              -John.

              1 of 1 people found this helpful
              • 4. Re: How to copy an NSHScript to another folder via CLI?
                Bill Robinson

                what version of bsa are you using ?

                • 5. Re: How to copy an NSHScript to another folder via CLI?

                  Hi John,

                   

                  I checked this file you mentioned, they're exist and readable

                   

                   

                  # ls -l /opt/bmc/bladelogic/NSH/br/xml/cli/NSHScript-Additional.xml

                  -rw-r--r--. 1 root root 46048 Nov 17  2013 /opt/bmc/bladelogic/NSH/br/xml/cli/NSHScript-Additional.xml

                  # ls -l /opt/bmc/bladelogic/NSH/br/server_xml/cli/NSHScript-Additional.xml

                  -rw-r--r--. 1 root root 46048 Nov 17  2013 /opt/bmc/bladelogic/NSH/br/server_xml/cli/NSHScript-Additional.xml

                  All available xml files in NSH/br/xml/cli directory are:

                  NSHScript-Additional.xml

                  NSHScriptFactory-Generated.xml

                  NSHScript-GeneralInfo.xml

                  NSHScript-Generated.xml

                  NSHScriptJob-Additional.xml

                  NSHScriptJobFactory-Generated.xml

                  NSHScriptJob-GeneralInfo.xml

                  NSHScriptJob-Generated.xml

                  NSHScriptJobParamRuntimeOptionsFactory-Generated.xml

                  NSHScriptJobParamRuntimeOptions-Generated.xml

                  NSHScriptParam-Additional.xml

                  NSHScriptParamFactory-Generated.xml

                  NSHScriptParam-GeneralInfo.xml

                  NSHScriptParam-Generated.xml

                  NSHScriptParamValueFactory-Generated.xml

                  NSHScriptParamValue-Generated.xml

                  NSHScriptService-Generated.xml

                   

                  In addition, I tried to remove the quotes for the DBKEY you told me, but it still doesn't work.

                   

                  Neil

                  • 6. Re: How to copy an NSHScript to another folder via CLI?

                    Hi Neil,

                     

                    Can you confirm you get the same error message if you run the command with an incorrect number of arguments? Sometimes BLCLI error messages happen to be a bit misleading for some reason. If the command is really not available in your environment, you should get the same error message if you invoke it with let's say no argument.

                     

                    If you get the incorrect number of arguments error message instead, it means that the problem could possibly be related to the way you specify your arguments or to some other problem.

                     

                     

                    You could also try to invoke your commands differently, using the following syntax:

                     

                        blcli -Dcom.bladelogic.cli.debug.release-only=false -m subshell

                     

                    which opens a BLCLI subshell where unreleased commands are explicitly made available. Try to invoke the NSHScript copyNSHScript string string string command in that subshell (starting with the namespace) and check if that makes a difference.

                     

                     

                    I would also check if the NSHScript-Additional.xml files don't have different date an time as the other files in the folder, which could indicate they've been altered.

                    • 7. Re: How to copy an NSHScript to another folder via CLI?

                      Wow! Impressive!

                      It's working, just use the "blcli -Dcom.bladelogic.cli.debug.release-only=false -m subshell" command you given to me.

                      # blcli -Dcom.bladelogic.cli.debug.release-only=false -m subshell

                       

                       

                      BLCLI>  NSHScript copyNSHScript "DBKey:SDepotObjectModelKeyImpl:2039679-1-68342530" "/Scripts/test" "test.pl"

                      DBKey:SDepotObjectModelKeyImpl:2039762-1-68451970

                      BLCLI> exit

                      Good Bye.

                       

                      Now it's clear: the command is not finally released in my Bladelogic version.

                      Now there is only one thing left to concern: how to put these commands to my script.

                      Thank you again Olivier!

                      • 8. Re: How to copy an NSHScript to another folder via CLI?
                        Bill Robinson

                        The performance commands (blcli_execute) have the unreleased commands enabled as well, so it should work in there.  if you run a ‘blcli_listjvmoptions’ (or blcli_printjvmoptions, I forget) you should see the same arg being passed to that, so this should also be available w/ ‘blcli_execute NSHScript xxx’