Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ping_intl.sh 715 B
#!/bin/bash
echo "Begin `date`"
echo "Host  `hostname`"

set -u
#set -x

HOSTNAME=`hostname`
RSPCONNECTIONS=$LOFARROOT/etc/StaticMetaData/RSPConnections_Cobalt.dat

# International stations have the name xx6xx.
#
# For each International Station VLAN, Cobalt has IP 10.x.x.50,
# and we need to ping 10.x.x.1.
SRCIPS=`
  <$RSPCONNECTIONS fgrep $HOSTNAME |
  grep -v "^#" |
  perl -ne '
    if (/^..60?(..?) .* 10[.]([0-9]+)[.]([0-9]+)[.]1../) {
      if ($3 == 1) {
        print "10.$2.$1.1\n"
      } else {
        print "10.$2.$3.1\n"
      }
    } '
`

echo "IPs   $SRCIPS"

for IP in $SRCIPS
do
  # Ping this RSP board, but don't wait for an answer
  ping -p 10fa -q -n -c 1 -w 1 $IP
done

echo "End   `date`"