Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Last active October 12, 2015 19:28
Show Gist options
  • Save toshimaru/4076525 to your computer and use it in GitHub Desktop.
Save toshimaru/4076525 to your computer and use it in GitHub Desktop.
複数ホストに ssh しながら tail -F
#!/bin/bash
#refs. http://blog.64p.org/entry/2012/08/24/165701
function kill_children {
pkill -P $$;
wait;
}
trap "kill_children" EXIT
HOSTS="192.168.1.1 192.168.1.2"
for host in $HOSTS
do
ssh $host tail -F /service/foo/log/main/current &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment