Skip to content

Instantly share code, notes, and snippets.

@pkazi
Created October 22, 2018 09:14
Show Gist options
  • Save pkazi/d219886e2de3233bfb2beaec21cb8d59 to your computer and use it in GitHub Desktop.
Save pkazi/d219886e2de3233bfb2beaec21cb8d59 to your computer and use it in GitHub Desktop.
DCOS Run any shell command on all slave nodes (private and public)
#!/bin/bash
# Run any shell command on all slave nodes (private and public)
# Usage : dcosRunOnAllSlaves.sh <CMD= any shell command to run, Ex: ulimit -a >
CMD=$1
for i in `dcos node | egrep -v "TYPE|master" | awk '{print $1}'`; do
echo -e "\n###> Running command [ $CMD ] on $i"
dcos node ssh --option StrictHostKeyChecking=no --option LogLevel=quiet --master-proxy --private-ip=$i "$CMD"
echo -e "======================================\n"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment