#!/bin/bash
# This file contains the commands necessary to capture a sniffer trace

Usage()
{
  echo "Usage: $0 [ethx]"
  echo "Captures a network trace on the published or specified interface (default $interface)"
  exit
}

interface=`/nn/bin/pdrcmd get "msm\config\publishedipaddress"`
if [ X${interface:0:3} != "Xeth" ]
then
  interface="eth1"
fi

if [ $# -gt 1 ]
then
  Usage
fi

if [ $# == 1 ]
then
  if [ X${1:0:3} != "Xeth" ]
  then
    Usage
  else
    interface=$1
  fi
fi

sysname=`uname -n`
date=`date +%F_%0k.%M.%S`

file=$NNLOGS/$sysname"_"$date.cap

echo Creating network capture file: $file
echo Press ctrl-C when done.
tcpdump -s 0 -n -nn -i $interface -w $file


