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