home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / admin / 4369 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.3 KB

  1. Xref: sparky comp.unix.admin:4369 comp.unix.questions:9550 comp.sys.sgi:11616
  2. Newsgroups: comp.unix.admin,comp.unix.questions,comp.sys.sgi
  3. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!odin!fido!zola!zuni!anchor!olson
  4. From: olson@anchor.esd.sgi.com (Dave Olson)
  5. Subject: Re: KEEPING RECORDS OF PRINT JOBS.
  6. Message-ID: <ntq454g@zuni.esd.sgi.com>
  7. Sender: news@zuni.esd.sgi.com (Net News)
  8. Organization:  Silicon Graphics, Inc.  Mountain View, CA
  9. References: <92211.080526KJB6@psuvm.psu.edu>
  10. Date: Wed, 29 Jul 92 21:15:53 GMT
  11. Lines: 57
  12.  
  13. In <92211.080526KJB6@psuvm.psu.edu> KJB6@psuvm.psu.edu writes:
  14.  
  15. | In this academic environment, I have a need to keep track of which "group" of
  16. | students use the printer. My plan was to give a "group id" depending on the
  17. | students majors, and then when a print job is sent to do something like:
  18. | "id |awk '{print $2}'
  19. |  echo $name $id `date` >> /usr/spool/lp/interface/logname"
  20.  
  21. Turn on rsh logging in /usr/etc/inetd.conf:
  22.     shell    stream    tcp    nowait    root    /usr/etc/rshd        rshd -L
  23. Add this line to /etc/syslog.conf:
  24.     auth.debug    |/usr/adm/rshd.filter    /usr/adm/SYSLOG
  25. And put this script in /usr/adm/rshd.filter (I add the lines to the
  26. normal lp log file, so I can match up requests with with actual
  27. time of printing):
  28. ============================
  29.     #! /bin/sh
  30.     # this filter rejects the routine rshd log messages for 'ordinary' users,
  31.     # while keeping those for privileged users
  32.     # it expects only a single line of input, and when accepting
  33.     # messages, outputs them without a newline
  34.     # messages that don't fit the rshd format expected are just passed
  35.     # back as is.
  36.     # rshd format is: rshd[PID]: orig_name as remote_name: cmd='the_cmd'
  37.  
  38.     read line
  39.     OFS="$IFS"
  40.     IFS="${IFS}=:"
  41.     set $line
  42.     IFS="$OFS"
  43.     if [ "$3" != as -o "$5" != cmd ]
  44.         then echo "$line\c"
  45.         exit 0
  46.     fi
  47.  
  48.     case "$4" {
  49.     lp)
  50.         shift # skip the rshd[pid]
  51.         date "+%D %H:%M $*" | egrep -v lpstat >> /usr/spool/lp/log 
  52.         exit 0 # not in syslog
  53.         ;;
  54.     *)
  55.         case "$6" {
  56.         \'lpstat*)
  57.             exit 0 ;; # some lpstat's run as guest
  58.         }
  59.         first="$1: $2 as $4: "
  60.         shift 5
  61.         echo "$first=$@\c"
  62.         exit 0 ;;
  63.     }
  64. ============================
  65. --
  66. Let no one tell me that silence gives consent,  |   Dave Olson
  67. because whoever is silent dissents.             |   Silicon Graphics, Inc.
  68.     Maria Isabel Barreno                        |   olson@sgi.com
  69.