Created
July 22, 2014 13:40
-
-
Save Avyd/219adb365f74355bf941 to your computer and use it in GitHub Desktop.
Short scripts and stuff to run commands on multiple servers
This file contains 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
for i in $(cat secnodes); do ssh -o StrictHostKeyChecking=no -l root $i -C "find /etc/cron* -type f -exec cat {} \; > cron_all" ; done | |
for i in $(cat secnodes); do echo -e "\n\n XXXXXXXXXX $i XXXXXXXXXX \n" ; ssh -o StrictHostKeyChecking=no -l root $i -C "cat cron_all" ; done | |
for i in $(cat nodes); do echo -e "\n\n XXXXXXXXXX $i XXXXXXXXXX \n" ; ssh -o StrictHostKeyChecking=no -l root $i -C "netstat -tunlp|grep 8080" ; done | |
for i in node51 node52 node53 ; do ssh -o StrictHostKeyChecking=no -l root $i -C "grep something /var/log/squid3/access.log" ; done | |
# Regex matching from irclogs | |
for x in $(find irclogs/ -name "*something*.log" -print) ; do egrep --only-matching "http(s?):\/\/[^ \"\(\)\<\>]*" $x ; done | |
# egrep AND .* | |
egrep "link.com.*10.7.7.7." /var/log/squid/access.log | |
# Run a script through ssh and not placing a file on a server | |
ssh 57.57.25.82 -l admin -C < local_script.sh | |
echo "Generated on: $(date)" | |
# Compare VRRP status on two nodes | |
ssh -o StrictHostKeyChecking=no [email protected] -C "show vrrp" && ssh -o StrictHostKeyChecking=no [email protected] "show vrrp" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment