Reputation: 27
I need to run different jobs on 2 nodes in one job. #!/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
Below is my reference job which uses ${option.NodeFilter1} and ${option.NodeFilter2} to pass node names to the actual 2 jobs.
I don't know if I have to run this reference job locally and these 2 actuall jobs to be pushed to the machines or this reference job should also be pushed to the actuall machines. ?
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
This is one of 2 actuall jobs
- id: 47b65475-f14b-4e5e-8d4f-aa9bb3c8e2b6
project: SecureCloud
loglevel: INFO
sequence:
keepgoing: false
strategy: node-first
commands:
- script: |
#!/bin/bash
touch /home/user/[email protected]@
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
I get this error while trying to run this configuration:
Option input was not valid for [apps/Synchronize mobile configurations Source]: Option 'NodeFilter1' is required. 13:50:58 Execution failed: 637: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [c000lrdp01na01.na01.mstrci.com: InvalidOptions: Invalid options: [NodeFilter1]]}, Node failures: {c000lrdp01na01.na01.mstrci.com=[InvalidOptions: Invalid options: [NodeFilter1]]}, flow control: Continue, status: failed
Upvotes: 2
Views: 1557
Reputation: 378
You can create two jobs, one each to perform the appropriate task on the separate nodes. Then create another job which executes both of those two jobs via the Job Reference feature. Make sure not to set a node filter in the third job.
Upvotes: 2