Part of running a cluster means automating tasks across many computers. Putting executable scripts in a repo of some kind (I use a private github one) makes it easy to make changes for testing, and you definitely want to use a script of some kind to automatically check out and run your executables. Many folks will probably already know how to do this - so this may not be useful to many. I might just be posting this here for posterity.
In /etc/init.d/rc.local do something like:
1 2 3 4 5 | |
The sleep makes the script wait for two minutes before running. I’ve found that without it, things don’t always work as expected. There are 25th level Linux wizards out there that could tell me why this is necessary - if you’re one and you feel like sharing some education, hit me up on Twitter.
Everything else is pretty much what you would run on the command line.
Test your script by running the rc.local file as you would any other bash script:
1
| |
Once the script is doing what you expect, you can do whatever you do to spin up your cluster. Each node should run your commands after they boot up and sleep for two minutes.
Happy clustering.