Changeset 10619 in genesis
- Timestamp:
- May 1, 2012, 9:06:34 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/batch-cmd
r10269 r10619 3 3 # Mega simple wrapper for batch control on nodes. 4 4 # 5 # Rick van der Zwet < info@rickvanderzwet.nl>5 # Rick van der Zwet <rick@wirelessleiden.nl> 6 6 # 7 7 8 HOSTS=${*:- `$(dirname $0)/gformat.py list all`}8 HOSTS=${*:-"`$(dirname $0)/gformat.py list up systems fqdn`"} 9 9 PREFIX=${PREFIX:-'ip'} 10 CMD=${CMD:-' ifconfig -a'}10 CMD=${CMD:-'md5 /usr/local/etc/rc.d/lvrouted'} 11 11 12 12 echo "# WARN: Going to run at: " $HOSTS; sleep 2 13 13 14 cat << 'EOF' >/tmp/command 15 sh -c ". /etc/rc.subr; load_rc_config "networking"; set" > /tmp/networking-env 16 grep -e ^ifconfig -e ^ipv4 /tmp/networking-env 17 { grep -e ^ipv4 /tmp/networking-env | cut -d= -f2 | tr -d \' | xargs -n1 | cut -d/ -f1; 18 grep -e ^ifconfig /tmp/networking-env | grep -v -i 'dhcp' | cut -d= -f2 | tr -d \' | cut -d' ' -f2 | cut -d'/' -f1 19 } | sort -u > /tmp/current 20 ifconfig -a | grep 'inet ' | cut -d' ' -f2 | sort > /tmp/config 21 echo "# Comparing IP differences /tmp/current vs /tmp/config" 22 sdiff /tmp/current /tmp/config 23 EOF 24 25 # Cleanup old entries 26 rm $PREFIX-* stderr-* 27 14 28 for HOST in $HOSTS; do 15 ssh -o ConnectTimeout=3 -o BatchMode=yes root@$HOST.wleiden.net. $CMD > $PREFIX-$HOST.txt & 29 stdout_file="$PREFIX-${HOST%%.}.txt" 30 stderr_file="stderr-${HOST%%.}.txt" 31 : > $stdout_file 32 : > $stderr_file 33 cat /tmp/command | ssh -o ConnectTimeout=3 -o BatchMode=yes root@$HOST 'cat >/tmp/command && sh /tmp/command' 1>$stdout_file 2>$stderr_file & 16 34 done 17 35 18 # Wait for all processes to complete. 36 echo "# Wait for all processes to complete." 19 37 wait
Note:
See TracChangeset
for help on using the changeset viewer.