2

我需要在一项作业中在 2 个节点上运行不同的作业。#!/bin/bash

#Create the following folders:
mkdir -p /shared_folder/files/Source
mkdir -p /shared_folder/files/Target


#Generate the backups
#Under Source execute the following command:
cp -r /local/folder /shared_folder/files/Source

#Under Target execute the following command:
cp -r /local/folder /shared_folder/files/Target

#Delete all Target mobile configurations:
#Under Target execute the following command:
rm /local/folder/*.*

#Copy the mobile configurations from Source to Target:
#Under Target execute the following command:
cp  /shared_folder/files/Source/*.* /local/folder/

Restart Tomcat Service in Target:
Under Target execute the following command:
/sbin/service tomcat restart

下面是我的参考作业,它使用 ${option.NodeFilter1} 和 ${option.NodeFilter2} 将节点名称传递给实际的 2 个作业。

我不知道我是否必须在本地运行此参考作业并将这 2 个实际作业推送到机器,或者此参考作业也应推送到实际机器。?

After suggestion I've created this job reference. It references 2 actual jobs.
- id: 98e41ff6-93e3-455a-9744-29bb6e8aae27
  project: SecureCloud
  loglevel: INFO
  sequence:
    keepgoing: false
    strategy: node-first
    commands:
    - jobref:
        group: apps
        name: Synchronize mobile configurations Source
        args: -Nodefilter1 ${option.NodeFilter1}
        nodeStep: 'true'
        nodefilters:
          filter: ${option.NodeFilter1}
      description: Source
    - jobref:
        group: apps
        name: Synchronize mobile configurations Destination
        args: -NodeFilter2 ${option.NodeFilter2}
        nodeStep: 'true'
        nodefilters:
         filter: ${option.NodeFilter2}
      description: Destination
  description: ''
  name: Synchronize mobile configurations Master
  uuid: 98e41ff6-93e3-455a-9744-29bb6e8aae27
  group: apps
 options:
    NodeFilter1:
      required: true
    NodeFilter2:
      required: true

这是 2 个实际工作之一

- id: 47b65475-f14b-4e5e-8d4f-aa9bb3c8e2b6
  project: SecureCloud
  loglevel: INFO
  sequence:
    keepgoing: false
    strategy: node-first
    commands:
    - script: |
        #!/bin/bash

        touch /home/user/source-@option.NodeFilter1@



      scriptInterpreter: sudo
      interpreterArgsQuoted: false
  description: Synchronize mobile configurations
  name: Synchronize mobile configurations Source
  uuid: 47b65475-f14b-4e5e-8d4f-aa9bb3c8e2b6
  nodefilters:
    dispatch:
      threadcount: 2
      keepgoing: true
      excludePrecedence: false
      rankOrder: ascending
    filter: ${option.NodeFilter1}
  group: apps
  options:
    NodeFilter1:
      required: true
      description: Source Node

尝试运行此配置时出现此错误:

选项输入对于 [应用程序/同步移动配置源] 无效:需要选项“NodeFilter1”。13:50:58 执行失败:637:[工作流结果:,步骤失败:{1=1 个节点上的调度失败:[c000lrdp01na01.na01.mstrci.com:InvalidOptions:无效选项:[NodeFilter1]]},节点故障: {c000lrdp01na01.na01.mstrci.com=[InvalidOptions: Invalid options: [NodeFilter1]]},流控:继续,状态:失败

4

1 回答 1

2

您可以创建两个作业,每个作业一个用于在单独的节点上执行适当的任务。然后通过 Job Reference 功能创建另一个执行这两个作业的作业。确保不要在第三个作业中设置节点过滤器。

于 2015-07-27T16:13:12.747 回答