Operating System - HP-UX
1837448 Members
3656 Online
110117 Solutions
New Discussion

How to know what data was printed ?

 
SOLVED
Go to solution
Olivier Decorse
Respected Contributor

How to know what data was printed ?

hello,
i'm searching to know the data an printer as receive and printed. Not only the date and the user, but all the data.

It seems that the /var/spool/lp/outputq containts this information, but because his binary format, i can't read it !
Is it readable, or is there an other file that containts this information.

Thank's. Olivier.
They say "install windows 2k, xp or better", so i install unix !
9 REPLIES 9
A. Clay Stephenson
Acclaimed Contributor

Re: How to know what data was printed ?

Hi,

You have two sources of data:
1) the lpstat command - man lpstat for details
2) the interface files
Each print queue (e.g. myprinter) has an interface script associated with /var/spool/lp/interface/myprinter

The lp commands feeds this script like this:
/var/spool/lp/interface/P id user title copies options file1 file2 ...

P - the name of the printer (e.g. myprinter)
id - lp request id
user - logname of user who made the request
title - optional report title
copies - number of copies requested by the user
options - the -o options passed to the lp command
file1 file2 - files to be printed

You could modify each of the interface files to
capture and log any of this data.

This should get you started, Clay
If it ain't broke, I can fix that.
Victor_5
Trusted Contributor

Re: How to know what data was printed ?

If your printer is a network printer, type
lpstat -o

You will be tell all the jobs in the queue, and see the printing percentage at the same time, however, if it is a serial printer, I have no idea since you only can get the total size of those jobs. Mabye you can calculate the estimate time.

Olivier Decorse
Respected Contributor

Re: How to know what data was printed ?

Thank you for your response, but :
1) it seems that the /var/spool/lp/output file almost containts this information, whitout including it in the filter file (is it a output file used by system ?) : so how is it possible to read/decode it ?
2) the lpstat prints what the lp will print, not what the lp has printed !!

thank's in advance for your response.
Olivier.
They say "install windows 2k, xp or better", so i install unix !
Andreas Voss
Honored Contributor

Re: How to know what data was printed ?

Hi,

i've made a hack of outputq.
Put you a binary file at attachment, i called it lplast.
Try it !

Regards
Andreas Voss
Honored Contributor
Solution

Re: How to know what data was printed ?

Hi,

sorry i've seen that binary attachments are not downloadable.
So now here's the file within a zip-archive.

Regards
Rainer von Bongartz
Honored Contributor

Re: How to know what data was printed ?

Andreas,

Thanks for lplast, really usefull stuff !!!
Should be worth 10 points.

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Olivier Decorse
Respected Contributor

Re: How to know what data was printed ?

Thank's a lot, Andreas !! It is very useful!!!
Your're right Rainer : should be worth 10 points !!
A last question, Andreas : you prints the size information : does the output file contains the data that were printed and is it possible to display it !?

Thank's in advance, Olivier.
They say "install windows 2k, xp or better", so i install unix !
SAM_24
Frequent Advisor

Re: How to know what data was printed ?

Hi Andreas,

Your script is awesome.
We were looking this type of output.

Thanks a lot.

Raj
Never quit
SAM_24
Frequent Advisor

Re: How to know what data was printed ?

Hi,

We don't know what is the printer status blocked means? Any idea?

Thanks
Raj
Never quit