"Fossies" - the Fresh Open Source Software Archive

Member "arpwatch-NG1.7/contrib/bihourly" (1 Mar 2007, 1182 Bytes) of archive /linux/misc/old/arpwatch-NG1.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 # @(#) $Id: bihourly.sh,v 1.2 2006/07/28 18:19:32 leres Exp $ (LBL)
    3 #
    4 #  bihourly arpwatch job
    5 #
    6 PATH=${PATH}:/usr/local/sbin
    7 export PATH
    8 #
    9 cd /usr/operator/arpwatch
   10 #
   11 list="`cat list`"
   12 cname="`cat cname`"
   13 temp1=/tmp/bihourly.1.$$
   14 temp2=/tmp/bihourly.2.$$
   15 d=/tmp/errs
   16 
   17 # imperfect hack
   18 l=/tmp/bihourly.lock
   19 if [ -f ${l} ]; then
   20     echo "skipping arpwatch bihourly job, lock file exists"
   21     exit
   22 fi
   23 
   24 trap 'rm -f ${l}; exit 1' 1 2 3 15
   25 touch ${l}
   26 
   27 alist=""
   28 for r in ${list}; do \
   29     ./arpfetch ${r} ${cname} > ${r} 2> ${temp1}
   30     if [ -s ${temp1} ]; then
   31         echo "arpfetch ${r} errors:"
   32         xr=${d}/${r}.$$
   33         echo "(file ${r} saved in ${xr})"
   34         mkdir -p ${d}
   35         cp ${r} ${xr}
   36         sed -e 's/^/    /' ${temp1}
   37         continue
   38     fi
   39     alist="${alist} ${r}"
   40 done
   41 
   42 arpsnmp -d ${alist} > ${temp1} 2>&1
   43 
   44 sed -e '/arpsnmp: suppressed DECnet flip flop/d' ${temp1} > ${temp2}
   45 if [ -s ${temp2} ]; then
   46     mail -s "`hostname` arpwatch report" \
   47         arpwatch-reports@noname.lbl.gov < ${temp2}
   48 fi
   49 rm -f ${temp1} ${temp2}
   50 
   51 d=/www/NETINFO/arpwatch
   52 
   53 f=arp.dat
   54 cp ${f} ${d}
   55 
   56 f=ethercodes.dat
   57 diff ethercodes.dat ${d} >>/dev/null 2>&1
   58 if [ $? -ne 0 ]; then
   59     echo Updating ${d}/${f}
   60     cp ${f} ${d}
   61 fi
   62 
   63 rm ${l}
   64 
   65 exit 0