| jun98.tar |
A Print Quota Scheme
Yao-Chiang Kan, Jackie Carlson, and Jen-Sheng Wang Reducing the cost of printer maintenance is usually an important issue for any organization, but is particularly so at a university. The cost of our printing supplies (paper and toner) reached a high last year of $40,000 at the College of Engineering at Michigan State University, and we were asked to implement print quotas for both UNIX and PC systems. This article explores that system and should provide techniques that can be applied to your environment, too. We needed to enforce print quotas without increasing costs and purchasing expensive software. With a few modifications to the interface files and a couple of scripts, we accomplished our goals. We implemented print quotas for our printers in public labs almost a year ago and have since reduced wear and tear on the printers and reduced toner, paper, and repair costs by 40%. The print quota scheme we designed is cost effective and simple to administer. In our computing environment, we deal with several different platforms: SUN Solaris, HP-UX 10.x, Windows NT, Windows 95, and Windows for Workgroup 3.11. We configured a SUN Sparc10 running Solaris 2.5.1 to be the print quota server for the UNIX labs and office printers. A SUN Sparc2 running Solaris 2.5.1 is the print quota server for four of our public PC labs. The Windows NT print clients talk to the print server using Microsoft's TCP/IP printing. PCs running Windows for Workgroups use the PCTCP lpr function to directly communicate with the Solaris print server. The UNIX print clients send print jobs to the print server by using SYS V printing. There are eight quota-enabled printers including six HP 4MV printers, one HP 5SI/MX printer, and one QMS color laser printer. All HP 4MV and 5SI/MX printers support a function called "True End of Job (TEOJ)" that causes the HP printers to return a page printed status message for a print job. The QMS printer has the "Background Channel (BC)" function, which is similar to HP's TEOJ. By using TEOJ and BC functions, our print quota system is established. The Print Quota Scheme Knowing how to set up a UNIX print server running Solaris is required, of course. A local printing process on Solaris is described in Figure 1. When a print job arrives on the print server, lpsched is evoked to handle that print job. lpsched is responsible for spooling the print request, filtering the job, and starting the interface program to actually print the job. Printer filters in Solaris are used to convert the content type of a file to a content type that is acceptable to the destination printer. The Solaris interface program does the final printing of the job and is the most important stage of the printing process. Our print quota scheme is implemented within the interface program. The print quota scheme requires four special files shown in Listing 1. (All listings for this article can be found at ftp.mfi.com in /pub/sysadmin.) The first file is a user print quota database (UPQdB), which has a file named the same as the user name. Every user has his or her own UPQdB file. The UPQdB contains several fields that are separated by colons. The first field in UPQdB is the user's print quota, the second one is total pages printed since the beginning of the semester, and the third field is pages printed in the current week. The rest of those fields are pages printed for each quota-enabled printer in the current week. The order of these printer fields is determined by the printer list file (PLF). The second file is the PLF, which stores a list of all quota-enabled printers. The third file stores the default quota (DQF) for all users. The last file is a user print-credit file (UPCF), which stores a user's purchased print quota left from the previous semester. Below is the process used to enforce user print quotas.
Steps of the interface program:
Steps of the cron job:
Steps to increase a user's quota:
Set Up a Print Quota Server The JetAdmin software for Solaris provides an interface file that utilizes most of the HP printers' functions. The JetAdmin software can be downloaded from Hewlett Packard's Web site:
http://www.hp.com/cposupport/indexes1/a.html
You can obtain the QMS UNIX host software from the QMS Web site:
http://www.qms.com/support/drivers/ \
To install the JetAdmin software on a system running Sun's Solaris, use the command pkgadd. Qinstall, which is included with the QMS software, can be used to install QMS. After QMS and JetAdmin have been installed, a printer queue can be set up using the utilities bundled with these packages. To install HP printers run jetadmin and follow the menu to configure a printer queue. For QMS printers, run addprt to add a printer queue. Remember to enable TEOJ and status log in the HP printer queue configuration and enable the BC function as part of the QMS printer configuration. After the queue has been installed, we can get the desired interface file from /etc/lp/interfaces/xxx, where xxx is the name of the print queue. From here on, these queues will not be necessary. They can be left there or deleted. Since the interface files are written in Bourne and Korn shells, a Bourne shell library was created to accomplish the print quota scheme. Listing 2 shows the library, PrnQt_lib.sh, with the functions needed to use print quotas. In this library, the location of UPQdB, PLF, DQF, and UPCF are specified by variables, UserPrnQtFile, PrnterListFile, GenPrnQtFile, and UserLeftQt, respectively. The Usermatch() function is used to verify a user against the NIS+ password table. The InitUserPrnQtFile() function initializes a user's UPQdB and adds the user's page credit into the user's UPQdB. The ChkPrnQt() function first checks the PLF for a new printer and then determines whether a user is over quota. This function also allows administrators to add a new quota-enabled printer at any time without being concerned with any inconsistencies of the user's UPQdB. The UpdatePrnQtFile() updates UPQdB. This function takes two arguments. We like to map one color page printed to be equivalent to printing 20 black-and-white pages. Thus, the first argument is the number of physical page printed, and the second is the cost equivalent of single pages printed. A print server might be a machine in the lab and a user might log on at the console or even remotely; thus, the evoked interface program, which runs UpdatePrnQt, will be owned by the person logged onto the print server. Thus, a C wrapper is needed to update the user quota file, which is owned by lp. This C program is listed in Listing 3, updatPrnQT.c. The next step is to find a place in the interface program to put PrnQt_lib.sh. Listing 4, model.QMS, is an example of a modifed interface file for a QMS color printer. This modified interface file updates UPQdB after every page printed. The interface file for the HP printer has two parts, one is under /etc/lp/interfaces, and the other is under /etc/lp/interface/model.orig. The first part deals with some settings; the second is the core program, which deals with the print jobs and is invoked by the first part. The library and modification go into the first part of interface program, which is listed in Listing 5, model.HP4MV. Listing 5 shows only the modified or the important portions of the program; the complete program is too large to include entirely. This modified interface file updates UPQdB after a print job is finished. The modifications of these two interface files can be classified as follows:
After modifying the interface program, we need to set up the print server with this modified interface program. The procedures for setting up a UNIX system running Sun's Solaris to be a print server are summarized below. (More details can be found in the System Administration Guide in Sun's Solaris Answerbook.)
The Responsibilities User Users need to be able to check their current pages printed. The script, shprnqt, in Listing 7, is used to show the current number of pages printed and print quota. In our current configuration, the partition, /PrnQt, is exported to every SUN and HP workstation. This configuration makes the script, shprnqt, very simple. Another reason to share /PrnQt is because this partition contains all installation scripts necessary to install both SUN and HP printer clients. At this point, users can only check their print quota from a UNIX system. Consultant Consultants need to be able to increase a user's print quota if a user purchased a token or provides a department account. Listing 8 shows that script. A wrapper program, Listing 9, is needed to allow consultants to change a user's quota. The permissions of that script should be set to 755. The permissions of the wrapper program should be set to 4750 and owned by lp and group by consultant. Administrator The administrator needs to edit the variable $Rdate in the usage report script, Listing 6, and modify it to be the date at the start of a new semester. The administrator must also maintain the quota-enabled printer list and default quota. Conclusion Although we consider this print quota scheme to be a work in progress, it works well and has saved us money. Print quotas have stopped the abuse of our printers. Users are paying more attention to both what and how much they print. The scheme itself can be refined and improved. Our future modifications will focus on the following:
About the AuthorYao-Chiang Kan was a System/Network graduate assistant for the Division of Engineering Computing Services (DECS) at Michigan State University (MSU) for the past three and a half years. He works on Electromagnetics research now and can be reached at kan@egr.msu.edu. Jackie Carlson is the manager of the System/Network in DECS at MSU. You can contact her at carlson@egr.msu.edu.
Jen-Sheng Wang is a System/Network graduate assistant for DECS at MSU, and his email address is wangjins@egr.msu.edu.
|