slayedbylucifer has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I need your expert suggestions. Let me explain what I am doing and then will present my questions:
I am working on a Perl project where my Perl script will monitor any new server being plugged into the datacenter. The moment it detects a new server in the datacenter, it will run a bunch of other security hardening Perl scripts in a particular sequence on those server to bring ‘em to our security standards.
The script which is doing this job is called Orchestrator.
Now, the whole flow is working fine however I am not able to process multiple servers at the same time.
e.g. If the 5 new servers are plugged in the datacenter, the script will pick one of them, run the flow and then pick the second one and run the flow…then pick third one and run the flow ….so on and so forth.
This is time consuming as each server customizations will take about 2 hrs to complete. So 5 servers will take 10 hrs and I don’t want this.
Question: How to make my orchestrator script to process multiple servers simultaneously?
I am a Linux sys admin who knows good amount of Perl and my knowledge of programming/development is extremely limited. I have googled about this and came with below 3 options:
Use threading in perl << I don’t know anything about threading and stu +ff. Use fork in perl script and fork a new instance of the same script whi +ch will work independently on each individual server. Run multiple instances of the script so that each will process a new s +erver simultaneously and independantly.
And I am absolutely not sure which one the best fit for my use case or is there anything else obvious which I missed out. Also have no idea how to practically incorporate any of above three options in my script.
Could you provide your suggestions on how to make my orchestrator work on multiple servers simultaneously.
Thanks.
|
---|