1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00
ctrl/scripts/mini-steward
2021-10-06 10:08:48 +02:00
..
hosts.txt added mini-steward script 2021-10-06 10:08:48 +02:00
loop-wrapper.sh added mini-steward script 2021-10-06 10:08:48 +02:00
README.md added mini-steward script 2021-10-06 10:08:48 +02:00
test.sh added mini-steward script 2021-10-06 10:08:48 +02:00

mini-steward

Loop over all lines of host ip addresses specified in the hosts.txt file, and execute the the script with the id.rsa given as the input argument. This script will run until done, to kill it use:

CTRL+z
pkill -f loop-wrapper

Overview

  • This is a helper script that will copy a script you want to run on one or more nodes, and execute it.
  • The result of running the script will be returned in the status.log file.
  • The script wil continue running until execution on all nodes are succesful.
  • The result when successful run on a host will be written to the done.log file, with the output specified.

Usage

Specify the the hosts to execute the script on in the hosts.txt file, notation ip-address,node-name separated by new lines.

Example :

10.0.0.1,node1
10.0.0.2,node2

And start running the script with:

./loop-wrapper <script-to-copy-and-execute> <path-to-id.rsa file>

The script to be executed

To get the output written to done.log from the script that have been copied and ran on the nodes, it should write the desired output to STDOUT as it's last thing before calling exit 0.

The same goes for error messages.

See more details in the test.sh file for an example.