-
-
Save adyrcz/725a66252fd9a7664385 to your computer and use it in GitHub Desktop.
Tail multiple logs on multiple hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTS=(PUT, YOUR, HOSTS, HERE) | |
LOGS=(access.*.log, error.*.log) | |
CMD="tail -f ${LOGS}" | |
echo "Hit CTRL-C to stop" | |
sleep 0.5 | |
PIDS="" | |
for host in ${HOSTS[*]} | |
do | |
ssh $host $CMD & | |
PIDS="$PIDS $!" | |
done | |
trap 'kill $PIDS' SIGINT | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment