[ale] lpd logging?

brian goldin @ 2478 [ESRI-Redlands] bgoldin at esri.com
Tue Apr 9 11:20:45 EDT 1996


try something like this...

( I tryed to annotate the variables as much as possible so that it 
  makes sence..)


#############   start    ####################
#!/bin/csh -f
 
set date = `date +%D.%T`    
set user = $argv[5]
set host = $argv[7]
set file = $argv[8]
 
set currentjob = "`sed -n -e '2,2l' lock`" 
set jobname = "`cat $currentjob |sort | grep N | head -1| cut -c2-100`"
set jobsize = `echo $currentjob | cut -c3-999` 
set jobsize = `ls -l df${jobsize} | awk '{print $5}'`
 
if (-w $file) then
 echo $date'|'$host'|'$user'|'$jobname'|'$jobsize >> $file 
endif
 
cat -
#############   END    ####################

remember, you have to put a filter name into the printcap file 
also, once you add a filter I don't believe that lpd will add form feeds
anymore so all of that is up to the filter.. here it was not necessary.

BTW:  I setup a little cron job to fire off a different script to extract
daily plotter usage this feeds the results into ghost-script where I make
a pretty little plot for management...


brian

$>
$>Ok, I got the printer up and running, finally.  Is there a way to log who 
$>prints what via lpd?  Hopefully so.
$>
$>TIA
$>
$>
$> 
$>Michael Ivey, SysAdmin  gstv.gsu.edu    |  Send mail with "Subject: GET LIST"
$>ivey at gsu.edu http://gstv.gsu.edu/~ivey  |  for PGP key, Geek Code block, etc.
$>                      I'm straight, but not narrow. 
$>
$>            Perl is the Pathway to Insanity.......My key to UNIX:
$>  perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
$>






More information about the Ale mailing list