Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Created May 27, 2014 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gene1wood/1b0d5a8f7c12910a28e0 to your computer and use it in GitHub Desktop.
Save gene1wood/1b0d5a8f7c12910a28e0 to your computer and use it in GitHub Desktop.
Tail the chef log across multiple hosts in parallel, exiting when the chef run completes
stack=1234
hostlist="`get_hosts $stack`"
pssh -O StrictHostKeyChecking=no \
--print \
--user ec2-user \
--host "$hostlist" \
--timeout=0 \
--par=20 \
'while true; do if ! tail -1 /var/log/chef.log | sed -e "s/^/`hostname`/" | grep -v "`date +%Y-%m-%d`.*Report handlers complete"; then tail -1 /var/log/chef.log | grep "`date +%Y-%m-%d`.*Report handlers complete"; break; fi; sleep 2; done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment