3 Replies Latest reply on Sep 12, 2016 2:44 PM by Bill Robinson

    BLCLI to delete NSH Script Jobs under Jobs Smart Group

    Cody Dean

      Has anyone done this before?  I have Job Smart Group that contains NSH Script Jobs and need to use BLCLI to remove them if possible. 

       

      Thank You,

      Cody

        • 1. Re: BLCLI to delete NSH Script Jobs under Jobs Smart Group
          Bill Robinson

          blcli_execute JobGroup groupNameToId "/path/to/smartgroup"

          blcli_execute SmartJobGroup groupNameToId "/Workspace/All Jobs"

          blcli_execute Job findAllHeadersByGroup 2001621

          blcli_execute SJobHeader getDBKey

          blcli_execute Utility setTargetObject

          blcli_execute Utility listPrint

          blcli_storeenv jobKeys

          while read key

          do

          blcli_execute Delete deleteModelObjectAndDependentObjects 111 ${key}

          done <<< "${jobKeys}"

          • 2. Re: BLCLI to delete NSH Script Jobs under Jobs Smart Group
            Cody Dean

            blcli_execute JobGroup groupNameToId "/path/to/smartgroup"

            blcli_execute SmartJobGroup groupNameToId "/Workspace/All Jobs"

            blcli_execute Job findAllHeadersByGroup 2001621

            blcli_execute SJobHeader getDBKey

            blcli_execute Utility setTargetObject

            blcli_execute Utility listPrint

            blcli_storeenv jobKeys

            while read key

            do

            blcli_execute Delete deleteModelObjectAndDependentObjects 111 ${key}

            done <<< "${jobKeys}"

             

            What is the bold'd line pertaining to?

             

            I am getting:

             

            Info09/12/2016 15:36:02JobRun Log Settings: JobRun Limit = 1000000
            Info09/12/2016 15:36:02Started running the job 'Cleanup Job' with priority 'NORMAL' on application server 'JOBSERVER'(34)
            Info09/12/2016 15:36:03Executing work item NSH Script Job:Cleanup Qualys Jobs;  on application server: JOBSERVER
            Error09/12/2016 15:36:10Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundException: Found command 'Delete.deleteModelObjectAndDependentObjects' but with mismatching arguments. : java.lang.IllegalArgumentException: Bad db key token :
            Info09/12/2016 15:36:102007754[][][]
            Info09/12/2016 15:36:10Exit Code 1
            Error09/12/2016 15:36:11The job 'Cleanup Job' has failed
            • 3. Re: BLCLI to delete NSH Script Jobs under Jobs Smart Group
              Bill Robinson

              sorry - forgot a couple things in the cut/paste:

               

              blcli_execute JobGroup groupNameToId "/path/to/smartgroup"

              blcli_storeenv groupId

              blcli_execute Job findAllHeadersByGroup ${groupId}

              blcli_execute SJobHeader getDBKey

              blcli_execute Utility setTargetObject

              blcli_execute Utility listPrint

              blcli_storeenv jobKeys

              while read key

              do

              blcli_execute Delete deleteModelObjectAndDependentObjects 111 ${key}

              done <<< "${jobKeys}"