

Printer Quotas in Linux? 27
borgquite asks: "At the
school that I work for students waste a lot of paper and toner because they
print without thinking. I've been looking at printer quota / charging software,
but unfortunately I can't seem to find any for Linux, and the
Windows
based
software is all priced
far too high. What I need to do is to say that students can print a certain
amount per day/week/month/year, and provide a system where they can
pay to increase their quota. I've looked for Linux / BSD based solutions,
but all I could find is lots of references to a tool called lpquota, but no
information on how I can obtain and implement this on my network. Does
anyone know of such a system?"
But it's educational (Score:1)
Of course, this was back when line-printers were still in use. Printing any code listing on a laser printer is pretty much worthless. I'd give my right arm for an old 9pin epson with formfeed.
Anyways, doesn't lpd(1) keep track of page count? Seems like you could do something with that, assuming all of the users have an account on the print server.
Re:But it's educational (Score:1)
How about just some money? I have an Epson LX-810 in good condition.
Post your e-mail here if interested.
Re:But it's educational (Score:1)
lprng/ifhp and printers with hardware pagecounters (Score:3, Informative)
I strongly recommend reading lprng doco regarding pagecounting. And then don't follow our example and use software based counting instead (which we may test when we get time.. I think it is also much easier to implement as good hardware page counters in printers are rare these days).
Re:no need for hardware pagecounters. (Score:2, Informative)
Fairly easy to implement (Score:1)
program that would:
1. Count how many times 'showpage' shows up in a
postscript doucment
2. keep track of how many 'showpage's each student
has sent
3. pass all arugment received by the program to lpr
4. gives lpr its own uid, have only that uid be able to access the printer, have only that uid be able to run lpr, and have your program run suid
Counting 'showpage' wont work (Score:2)
To count the number of pages in a PostScript file you'll have to run it through a PostScript interpreter (e.g. GhostScript) and get it to count the pages. You'll then have to send the PS to the printer (or if you have a non-PS printer driven by GS you could count the pages and spit the GS output to the printer simultaneously).
Printers with hardware page counters are a better bet - get the page count, print the job, get the page count, subtract.
Good point (Score:1)
Re:Counting 'showpage' wont work (Score:1)
statusdict begin pagecount
10 mod {showpage} 1 add repeat
In addition, I believe it would be possible to write a PostScript program that could figure out if it's running under an interpreter and behave accordingly (requires some research).
So, if you have any PostScript hackers, your best bet is to rely on a hardware page count. If you don't have any hackers, on the other hand, you can simply count the "%%Pages:" DSC comment that PostScript-generating programs put in
Re:Counting 'showpage' wont work (Score:1)
Instead of:
10 mod {showpage} 1 add repeat
It should be:
10 mod 1 add {showpage} repeat
PostScript is a beatiful language
Re:Counting 'showpage' wont work (Score:2)
My problem with hardware page counters is how to determine when to query the printer. Surely the printer will cache up as much of the print job as it can and as soon as it has then the spooler will think its done, and if you get a pagecount then the printer wont have done all the pages.
I really think there has to be some way of the printer saying 'I've just finished job XXX, and I printed YYY pages' in order to do it reliably.
Baz
Re:Fairly easy to implement (Score:2)
Re:Fairly easy to implement (Score:1)
CUPS (Score:3, Informative)
MIT quotas (Score:1)
the quota software MIT used to use. MIT has
a very heterogenous environment so that speaks
well for this. It's also interesting to note
that MIT no longer enforces a printing quota.
Previously students were allowed 1000 pages per year free, and additional at some preset rate.
Other options (Score:2)
Printbill for fair quotas (Score:2)
It's designed to be used in a pre-pay system. But it's all in perl, so you could easily hack it to support other methods (i.e. email them a bill at the end of the semester, etc.)
-Andy
bounce queues (Score:2)
All of the "public" queues are located on a central server, where the jobs are "cooked" by ghostscript, troff, whatever (you can easily create very specialized queues!) and the results 'bounced' into a 'raw' queue for each printer. The raw queues may be held on the print server, but they ultimately feed queues on the systems that host the individual printers.
The point of mentioning this? It's not practical to count the number of pages of the original queue, but it shouldn't be hard to run the 'raw' queue through a filter that parses the PCL being sent to the printer and counts the number of "page eject" (or whatever PCL uses) in each job. At worst this would require an additional bounce queue for each printer, but it wouldn't require additional disk space since the jobs shouldn't remain in this queue for long.
Roll your own? (Score:2)
It worked pretty well, apart from some issues with certain printer drivers where my scripts didn't pick up the fact it was postscript so it counted the number of lines/80! For graphics, this gave some very skewed results, but that was fixed easily enough. Wish I'd kept the scripts; they took me a while to write...
See http://printing.kde.org for a tutorial (Score:3, Informative)
PaperCut for linux (Score:2, Interesting)
Washington Univesity (Score:3, Interesting)
You also might want to be sure that this is a good idea, like I said, we run lpquota, but don't enforce it 'cause it's not worth the time to track down and add a $.50 charge to someone's transcript, have them raise hell 'cause they didn't know there was a printer limit, and then ultimately get someone to remove it. Not to mention then getting your ass chewed after this happens enough times.
If you actually want to affect the people who print out large numbers of pages, screen out any print jobs larger than 50 pages (not file size) - it's amazing how many people view something a few pagedowns into a really long (poorly segmented) webpage, and then click pring, expecting only that page to show up, and then not realize that it comes out as 104 pages take the 1 they want and throw the rest away (ignoring the bright blue recycle bin). If people complain to your lab admins or whoever, it's an excellent chance to teach them the wonders of how to choose exactly which pages (ie, pages 3-4) they actually want.
Take a look at ppr (Score:1)
http://ppr.trincoll.edu/