#!/bin/bash rm -f make-ver.gcc*.fsffrance.org function kill_ssh() { ps | grep ssh | awk '{print $1}' | xargs kill } function ctrl_c() { kill_ssh } trap ctrl_c INT function do_ssh() { cmd="sh -c '[ -f /etc/os-release ] && cat /etc/os-release; printf \"hostname: \"; hostname; printf \"uname: \"; uname -a; ((make -v 2>&1 | grep -q GNU) && make -v) || ((gmake -v 2>&1 | grep -q GNU) && gmake -v)' 2>&1" # Retry 5 times, wait 5 seconds between attempts. for i in {1..5} do ssh -q -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oBatchMode=yes gcc$h.fsffrance.org "$cmd" >make-ver.gcc$h.fsffrance.org 2>&1 && break || sleep 5; done } for h in `seq 1 250` do do_ssh & done echo "waiting 30s..." sleep 30 kill_ssh # Move inaccessible hosts out of the way. mkdir -p nohost find . -maxdepth 1 -size 0 | while read line; do mv $line nohost/; done grep -l "Network is unreachable" make-ver.gcc* | while read line; do mv $line nohost/; done grep -l "Connection timed out" make-ver.gcc* | while read line; do mv $line nohost/; done grep -l "Permission denied" make-ver.gcc* | while read line; do mv $line nohost/; done grep -l "Could not resolve hostname" make-ver.gcc* | while read line; do mv $line nohost/; done grep -l "Connection refused" make-ver.gcc* | while read line; do mv $line nohost/; done printf "Number of accessible hostnames: " ls make-ver.gcc* | wc -l printf "Number of inaccessible hostnames: " ls nohost/make-ver.gcc* | wc -l printf "Hostnames with GNU Make: " grep -l "GNU Make" make-ver.gcc* | wc -l printf "Hostnames without GNU Make: " grep -L "GNU Make" make-ver.gcc* | wc -l echo "Distribution: " grep -h "GNU Make" make-ver.gcc* | sort | uniq -c # Kill dups (found via uname in the ssh command) (fdupes -f . | grep -v '^$' | xargs rm -v)2>&1 >/dev/null printf "Unique hosts with GNU Make: " grep -l "GNU Make" make-ver.gcc* | wc -l printf "Unique hosts without GNU Make: " grep -L "GNU Make" make-ver.gcc* | wc -l echo "Distribution: " grep -h "GNU Make" make-ver.gcc* | sort | uniq -c