AIX AUSTIN SUPPORT CENTER Last Updated: June 15, 1992 PRINTER ACCOUNTING INFORMATION BSD COMPATIBILITY: -Our printer accounting uses the BSD PAC routines that prepare print/plotter accounting records for processing. Our accounting was a standard port with no enhancements. -/usr/bin/pac is used to prepare printer/plotter accounting records for individual users or users of a selected printer. -the /usr/bin/pac unit of measure is the number of pages; the output is given as the number of units used and the charge in dollars. -the /usr/bin/pac will display the number of printed pages and the charge sorted by user when it generates a report: EXAMPLE: login pages/feet runs price root 3.00 3 usd . cmd 116.00 3 usd . -the qdaemon and the accounting system work together to gather the data. The qdaemon writes the user's name, job number, and the name of the file to be printed to the /usr/adm/qacct file. -date in /usr/adm/qacct is in binary format and must be manipulated by the queueacct routines in the runacct shell script to sort the queue accounting records, convert the raw binary into tacct.h format and merge records with other records into accounting records and dayacct records.. JOBS NOT TRACKED: Printer accounting keeps track of the printer usage of local printers and plotters that are not in poscript/passthru mode. Network printers are not tracked due to the fact that they are in passthru mode. REASON WHY JOBS ARE NOT TRACKED: TRACKED: The queueing system will not add any accounting records when using the -dp (passthru mode) because the backend cannot determine the number of pages that will be required since the backend is not formatting the data. Remote printers are in passthru by design. POSSIBLE SOLUTIONS TO JOBS NOT BEING TRACKED BY DEFAULT ACCOUNTING: QUESTION: We have the accounting set up properly, however; I know the queueing system will not add any accounting records when using the -dp (passthru mode) because the backend can not determine the number of pages that will be required since the backend is not formatting the data. What I need is some sort of printer accounting even if it is just something that will let us know when a postscript printer is accessed and the size of the file being printed. A: I've written and tested a small generic script file that can be used to encapsulate your print command and produce the minimum output to a log file, a time and date stamp and file size, that is requested: echo `date` >> plog ls -l $1 ! cut -c29-39 >> plog enq -P $1 where ` is a backtic, ! is a pipe or vertical bar, and plog is a sample log file name. You can substitute for the enq line whatever print command you use. This will put the date and time on one line of the log file and the file size below it. You can enhance these few lines to your heart's content, in the shell language of your choice. One idea is to modify it to print multiple files by building a while loop around it. In a C script that could take the form of: while ("$1" ]= "") ... (the 3 lines above) shift end You might also prefer to "wc -l" the file to get the number of lines rather than the file size. This could then be divided by 66 or whatever the page length is for the printer (add one for any remainder), for a page count. ACCESSING THE ACCOUNTING DATA: The queueing system uses the bsd method of accounting which creates a file which can be read by the pac command. The accounting system, which uses the qacct file, is based on the AT&T accounting format. acctmerg -q will read files in accrec.h format and output records sorted by uid and user name. Output records contain uid, user name and page printed. Examples of usage: acctmerg -q filename acctmerg -q