For a specific use case , it was asked to create jobs running same script on 30 agents ,each one defined on its dedicated server.
Also depending on the server list ,we had to start jobs with specific users.
So is there a way avoid to create 30 individual jobs?
Maybe we can find an optimal solution and guess it is by using Control-M hostgroup feature!
Name your host groups and add the Control-M agents inside
- Go on CCM and create your first hostgroup:
- Add the server to each hostgroup:
- Repeat the task for each of the hostgroups ( example HOSTGROUP1 I have added SERVER4,SERVER7 and removed SERVER1 ),HOSTGROUP2,HOSTGROUP3 and so on.
Define your jobs using dedicated host groups
- So for our example we have 4 jobs, each one referring to a specific Hostgroup in that way:
Add the corresponding hostgroups and user to the corresponding jobs
Don’t forget to tick the box “Run job on all Hosts in the group“
This will have for effect to execute the command on all of the hostname in the hostgroup instead of sending command to the first server available
Order your job
- Right click on the job and select order:
- We will order it on hold status for this test:
- When your job is ordered you will see that a job is ordered for each of the agent defined in the hostgroup ( here we have two jobs: one for SERVER4 and one for SERVER7 with same name but different order ID )
- When we check the job properties we can see that “Host group” field HOSTGROUP1 is replaced directly by the hostname SERVER4
- For the second job it will be SERVER7 as expected:
You can repeat this action for each of the hostgroup created and update the job definition with the specific user.
In example HOSTGROUP2 will run the job created for SERVER3/5/6 with user USR2
You will have as a result as many jobs as you have defined agent in the hostgroup 🙂
We can see that you can create a simple job to run it on multiple hosts ,that will ease your life if you need to manage this specific use case . 🙂
Don’t forget to visit dbi bloggers to have more and more valuable tips and trick on your favorite software 🙂