Reputation: 51
I have multiple Unix servers where I need to stop and start few services (name of the service are same in all servers and login user and password is also same). I am able to restart services for single unix server using Execute shell script on remote host using ssh. But not able to do for multiple servers.
Ex: Server 1 and server 2 (Both are unix servers) script file name: sample.sh
order to run this script using Jenkins:
please let me know how to achieve this using Jenkins. I have done this by creating 4 job for 4 steps and then pipelined them. But in real time i have more than 10 servers and i believe this is not a good way to do.
Upvotes: 0
Views: 1090
Reputation: 4767
I think your best approach would be using the Matrix Project plugin. We use it to run adminstration tasks on all nodes matching a given label in parallel.
Trivally, you can use one matrix job to stop service on all nodes and when done, trigger 2nd job to start all nodes.
It has lots of extension points defined as well.
From the notes;
You have to choose "Build multi-configuration project" when creating a project, it can not be changed later. If you skip this step, you will be very confused and not get very far Each configuration is akin to an individual job. It has its own build history, logs, environment, etc. The history of your multi-config job only shows you a list of configurations executed. You have to drill into each configuration to see the history and console logs.
Upvotes: 1