Annotation of coherent/g/usr/lib/uucp/tay104/contrib/uuq.sh, revision 1.1

1.1     ! root        1: #!/bin/sh
        !             2: #
        !             3: # uuq - a script to examine and display the Taylor spool directory contents.
        !             4: #       note - uses the uuname script or similar functionality.
        !             5: # Zacharias Beckman
        !             6: 
        !             7: SPOOLDIR="/usr/spool/uucp"
        !             8: SYSTEMS=`uuname`
        !             9: TMPFILE="/tmp/uuq.tmp"
        !            10: FORSYSTEM=""
        !            11: DELETE=""
        !            12: LONG=0
        !            13: SINGLE=0
        !            14: 
        !            15: while [ "$1" != "" ]
        !            16: do
        !            17:   case $1 in
        !            18:     -l) LONG=1
        !            19:         shift
        !            20:         ;;
        !            21:     -s) shift
        !            22:         SYSTEMS=$argv[1]
        !            23:         SINGLE=1
        !            24:         shift
        !            25:         ;;
        !            26:     -d) shift
        !            27:         DELETE=$argv[1]
        !            28:         shift
        !            29:         ;;
        !            30:     -h) echo "uuq: usage uuq [options]"
        !            31:         echo "     -l    long listing (may take a while)"
        !            32:         echo "     -s n  run uuq only for system n"
        !            33:         echo "     -d n  delete item n from the queue (required -s)"
        !            34:         exit 1
        !            35:             ;;
        !            36:         *)  echo "uuq: invalid option"
        !            37:             exit 1
        !            38:             ;;
        !            39:   esac
        !            40: done
        !            41: 
        !            42: if [ "${DELETE}" != "" ] && [ ${SINGLE} != 1 ] ; then
        !            43:   echo "uuq: you must specify a system to delete the job from:"
        !            44:   echo "     uuq -s wizard -d D.0004"
        !            45:   exit 1
        !            46: fi
        !            47: 
        !            48: cd ${SPOOLDIR}
        !            49: 
        !            50: # if we are deleting a job, then do that first and exit without showing
        !            51: # any other queue information
        !            52: 
        !            53: if [ "${DELETE}" != "" ] ; then
        !            54:   if [ -d ${SYSTEMS}/D. ] ; then
        !            55:     cd ${SYSTEMS}/C.
        !            56:     PACKET=${DELETE}
        !            57:     if [ -f ${PACKET} ] ; then
        !            58:       EXFILE=../D.X/`awk '{if (NR == 2) print $2}' ${PACKET}`
        !            59:       DFILE=../D./`awk '{if (NR == 1) print $2}' ${PACKET}`
        !            60:       echo "deleting job ${PACKET}"
        !            61:       rm ${PACKET}
        !            62:       rm ${EXFILE}
        !            63:       rm ${DFILE}
        !            64:     else
        !            65:       echo "uuq: job ${PACKET} not found"
        !            66:       exit 1
        !            67:     fi
        !            68:   else
        !            69:     echo "uuq: system ${SYSTEMS} not found"
        !            70:   fi
        !            71: 
        !            72:   exit 1
        !            73: fi
        !            74: 
        !            75: # use the 'uuname' script to obtain a list of systems for the 'sys' file,
        !            76: # then step through each directory looking for appropriate information.
        !            77: 
        !            78: if [ ${LONG} -gt 0 ] ; then
        !            79:   echo "system"
        !            80:   echo -n "job#    act size       command"
        !            81: fi
        !            82: 
        !            83: for DESTSYSTEM in ${SYSTEMS} ; do
        !            84:   # if there is an existing directory for the named system, cd into it and
        !            85:   # "do the right thing."
        !            86: 
        !            87:   if [ -d ${DESTSYSTEM} ] ; then
        !            88:     cd ${DESTSYSTEM}/C.
        !            89: 
        !            90:     PACKET=`ls`
        !            91: 
        !            92:     if [ "${PACKET}" != "" ] ; then
        !            93:       # if a long listing has been required, extra information is printed
        !            94: 
        !            95:       echo ""
        !            96:       echo "${DESTSYSTEM}:"
        !            97: 
        !            98:       # now each packet must be examined and appropriate information is
        !            99:       # printed for this system
        !           100: 
        !           101:       if [ ${LONG} -gt 0 ] ; then
        !           102:         for PACKET in * ; do
        !           103:           EXFILE=../D.X/`awk '{if (NR == 2) print $2}' ${PACKET}`
        !           104:           DFILE=../D./`awk '{if (NR == 1) print $2}' ${PACKET}`
        !           105:           echo -n "${PACKET} " > ${TMPFILE}
        !           106:           gawk '{if (NR == 2) printf(" %s  ", $1);}' ${PACKET} >> ${TMPFILE}
        !           107:           ls -l ${DFILE}|awk '{printf("%-10d ", $4)}' >> ${TMPFILE}
        !           108:           if [ -f ${EXFILE} ] ; then
        !           109:             gawk '/U / {printf("(%s)", $2);}\
        !           110:                   /C / {print substr($0,2,length($0));}' ${EXFILE} >> ${TMPFILE}
        !           111:           else
        !           112:             echo "---" >> ${TMPFILE}
        !           113:           fi
        !           114: 
        !           115:           cat ${TMPFILE}
        !           116:         done
        !           117:         cat ${SPOOLDIR}/.Status/${DESTSYSTEM}
        !           118:       else
        !           119:         ls
        !           120:       fi
        !           121:     fi
        !           122:   fi
        !           123: 
        !           124:   cd ${SPOOLDIR}
        !           125: done

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.