Changeset 10619 in genesis


Ignore:
Timestamp:
May 1, 2012, 9:06:34 AM (13 years ago)
Author:
rick
Message:

Find differences between active IP configuration and stored IP configuration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/batch-cmd

    r10269 r10619  
    33# Mega simple wrapper for batch control on nodes.
    44#
    5 # Rick van der Zwet <info@rickvanderzwet.nl>
     5# Rick van der Zwet <rick@wirelessleiden.nl>
    66#
    77
    8 HOSTS=${*:-`$(dirname $0)/gformat.py list all`}
     8HOSTS=${*:-"`$(dirname $0)/gformat.py list up systems fqdn`"}
    99PREFIX=${PREFIX:-'ip'}
    10 CMD=${CMD:-'ifconfig -a'}
     10CMD=${CMD:-'md5 /usr/local/etc/rc.d/lvrouted'}
    1111
    1212echo "# WARN: Going to run at: " $HOSTS; sleep 2
    1313
     14cat << 'EOF' >/tmp/command
     15sh -c ". /etc/rc.subr; load_rc_config "networking"; set" > /tmp/networking-env
     16grep -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
     20ifconfig -a | grep 'inet ' | cut -d' ' -f2 | sort > /tmp/config
     21echo "# Comparing IP differences /tmp/current vs /tmp/config"
     22sdiff /tmp/current /tmp/config
     23EOF
     24
     25# Cleanup old entries
     26rm $PREFIX-* stderr-*
     27
    1428for 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 &
    1634done
    1735
    18 # Wait for all processes to complete.
     36echo "# Wait for all processes to complete."
    1937wait
Note: See TracChangeset for help on using the changeset viewer.