|sockets|c|makefiles|C++|emacs|vi|IMAP|unix|sockets|tcl/tk|expect|NIS|cde|perl|html|unicode|javascript|java|netscape|ascii|Quality

Finding the biggest & best machines

The load sharing facility in S3 can be read about
here in the FAQomatic. We cannot usually sumbit any of our builds or test runs as the environment LSF starts under doesn't match when we log in as user. e.g. bsub precheckin (will send you a mail with error message after it has tried) bsub -Is "grpnpapi;cd $PWD;precheckin" ??

It is worth setting up environment when running large simulations. To debug LSF environment try bsub -Is 'echo $HOME;pwd;setenv;make'
?bsub -Is "setenv HOME $HOME;cd "`pwd`";make"?

which bsub? /appli/tools/lsf/4.1/sparc-sol2/bin/bsub

As part of LSF there are some useful commands which show info
about machines in S3.

Zeus_HOME> lshosts
HOST_NAME      type    model  cpuf ncpus maxmem maxswp server RESOURCES
pontiac      SUNSOL SUN_U80_   6.4     4  4096M  7981M    Yes ()
bentley      SUNSOL SUN_U80_   6.4     -      -      -    Yes ()
skoda        SUNSOL SUN_U80_   6.4     2  4096M  7968M    Yes ()
civic        SUNSOL SUN_U80_   6.4     2  4096M  8005M    Yes ()
naul         SUNSOL SUN_U80_   6.4     2  1024M  2979M    Yes ()
bangor       SUNSOL SUN_U60_   5.3     2  1280M  3272M    Yes ()
knock        SUNSOL SUN_U60_   5.3     2  1280M  3232M    Yes ()
avoca        SUNSOL SUN_U60_   6.3     2  1024M  2376M    Yes ()
roosky       SUNSOL SUN_U60_   5.3     2   512M  2518M    Yes ()
colt         SUNSOL SUN_U60_   6.3     2  1536M  3520M    Yes ()
mazda        SUNSOL SUN_U60_   6.3     1  1536M  3453M    Yes ()
jaguar       SUNSOL SUN_U60_   5.3     2  2048M  3916M    Yes ()
clifden      SUNSOL SUN_U60_   6.3     2  1024M  2904M    Yes ()
saab         SUNSOL UNKNOWN_   1.0     -      -      -     No ()
fergus       SUNSOL UNKNOWN_   1.0     -      -      -     No ()
zeus         SUNSOL UNKNOWN_   1.0     -      -      -     No ()

Zeus_HOME> lsload
HOST_NAME       status  r15s   r1m  r15m   ut    pg  ls    it   tmp   swp   mem
colt                ok   0.0   0.0   0.2   0%   0.0   1  2866 3178M 3180M 1239M
clifden             ok   0.0   0.0   0.0   1%   0.0   0 67776 2636M 2638M   73M
mazda               ok   0.0   0.0   0.1   3%   0.0   3     0 2994M 2996M  470M
pontiac             ok   1.1   1.1   1.2  27%  17.3   8     2 6112M 6114M 1262M
skoda               ok   0.6   0.6   0.1  30%   0.7   1    15 6308M 6308M 2578M
knock               ok   0.0   0.0   0.4   0%   0.0   0   294 2982M 2984M 1152M
bangor              ok   0.0   0.0   0.1   1%   0.0   1     1 2892M 2894M  833M
civic               ok   0.9   0.9   0.9  47%   0.0   2   254 6500M 6500M 3088M
jaguar              ok   0.3   0.3   0.2  12%   0.0   8     0 2308M 2310M  593M
naul                ok   2.0   2.0   1.8  96%   8.9   6     1  229M  233M   17M
roosky              ok   1.9   1.9   1.5  99%   0.0   0 3e+05 2014M 2016M   66M
avoca               ok   4.6   3.7   3.5 100%   0.0   2     1 2304M 2306M  746M
bentley         unavail

unix scripting/sysadmin/programming

Head straight on to the unix course on
Jerry O'Mahony's page.

When scripting don't use csh, use bash or sh

#!/usr/bin/sh

CHECKEXPECTEDFPP=0
CHECKEXPECTEDRSP=0

if [ $# -lt 1 ] ; then
  echo usage: runAgereSimulation testname [testexpectedfpp] [testexpectedrsp]
  echo where testname.xml exists 
  exit
else
  TESTXMLNAME=$1.xml
  TESTDBNAME=$1db
  TESTOUT=$1.testout
fi

if [ $# -ge 2 ] ; then
  TESTEXPECTEDFPP=$2
  CHECKEXPECTEDFPP=1
  if [ ! -e "$TESTEXPECTEDFPP" ] ; then
     echo can\'t find expected file $TESTEXPECTEDFPP
     echo can\'t find expected file $TESTEXPECTEDFPP > $TESTEXPECTEDFPP
#     exit;
  fi
fi

echo xml $TESTXMLNAME db $TESTDBNAME testout $TESTOUT exp $TESTEXPECTED

if [ ! -e "$TESTXMLNAME" ] ; then
   echo can\'t find xml file $TESTXMLNAME
   exit;
fi

OUTPUTFPP=0
OUTPUTRSP=0

#echo diffing
if [ $CHECKEXPECTEDFPP -eq 1 ] ; then
  OUTPUTFPP=`diff packetdump.txt $TESTEXPECTEDFPP |wc -l`
fi

if [ $CHECKEXPECTEDRSP -eq 1 ] ; then
  OUTPUTRSP=`diff rspdump.txt $TESTEXPECTEDRSP |wc -l`
fi

#arithmetic trickey to do
if [ $(( $OUTPUTFPP + $OUTPUTRSP )) -eq 0 ] ; then
  echo test pass
  echo "$2" >>results.txt
  echo test pass >> results.txt
else
  echo test fail fppdiff=$OUTPUTFPP rspdiff=$OUTPUTRSP
  cp packetdump.txt $TESTEXPECTEDFPP.notasexpected
  cp rspdump.txt $TESTEXPECTEDRSP.notasexpected
  echo "$2" >>results.txt
  echo test fail fppdiff=$OUTPUTFPP rspdiff=$OUTPUTRSP >> results.txt
fi

Handy UNIX references

Handy sed/awk/find things

#for every file, run something and output to something.else
ls *.fpo | sed "s/^\(.*\)/.\/a.out \1 >\1.hex/"

#grep for something (code symbols here), then sort (by address here), awk
#to find lines matching something AND print line before that too
nm /lib/libcrypt.a | grep ' [tT] ' | sort | awk '{store0=$0; } /.*UnknownFunction/{print store1; print $0} {store1=store0; } '

#find files matching something and grep them for something else
alias findgrep 'find . -name \!#:1 -exec grep -Hni "\!#:2"'"'{}' ';'"

#in aliases
\!* is all params
\!$ is last param
\!#: is all including alias name!!
\!#:1 is 1st param
\!#:2 is 2nd param

fork, signals

  pid_t localPid = -1;
  if ((localPid = fork())==-1){
     cout << "telnet:telnetClient: fork failed.....Exiting." << endl;
     perror("telnet:telnetClient");
     exit(1);
  } else if (localPid==0) {
     TELNETDBG(cout << "telnet:telnetClient:user child" << endl);
     // do child actions, use _exit to exit without killing stdin/stdout/stderr fds & other stuff
     _exit(0);
     }
  } else {
     TELNETDBG(cout << "telnet:telnetClient: forked child to read & send user input, pid: " << localPid << endl);
  }

Sockets

rfc854 telnet protocol ktelnet zeus 23

telnet:processData Received Message From Server -> ÿýÿýÿý#ÿý'ÿý$
telnet:processData hexdump 255 253 24 255 253 31 255 253 35 255 253 39 255 253 36 
                           IAC DO     IAC DO     IAC DO     IAC DO     IAC DO     

see rfc1010 for port number info. e.g. 53 is DNS, 143 imap2, cmip manager/agent 163/164 google/search ?q=X+port+number or ?q= cache rfc1700 rfc822

socket TIME_WAIT info

NIS

RFC882 RFC883 in.named RFC1034 RFC1035 Port numbers: RFC1010 port 53 - DNS

Internetworking Technology Overview from Cisco

|sockets|c|makefiles|C++|emacs|vi|IMAP|unix|sockets|tcl/tk|expect|NIS|cde|perl|html|unicode|javascript|java|netscape|ascii|Quality