Skip to content

Instantly share code, notes, and snippets.

@Avyd
Created July 22, 2014 13:40
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 Avyd/219adb365f74355bf941 to your computer and use it in GitHub Desktop.
Save Avyd/219adb365f74355bf941 to your computer and use it in GitHub Desktop.
Short scripts and stuff to run commands on multiple servers
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 root@watever.com -C "show vrrp" && ssh -o StrictHostKeyChecking=no root@watever.com-C "show vrrp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment