Understanding CUPS

To manage a CUPS print environment properly, you need to understand how it works. Therefore, in this section you will learn what happens when a user sends a print job to the printer and how the CUPS print system is involved. In later sections in this chapter, I'll discuss all the different parts of the CUPS printing process in more depth.

1. Every print job starts with the user submitting a print job. If the user is a local user, this could happen by using the lpr command to submit the print job to the CUPS printer directly.

2. The printer client command (for example, lpr) determines in which queue the job needs to be placed. This queue is present as a directory in /var/spool/cups.

3. On a regular basis, the cupsd printer daemon checks the queues for changes, such as new jobs being submitted. If a print job is submitted, the CUPS daemon analyzes its data and submits it to the required filter.

4. The most important part in the CUPS printing process is the print filter. First, using the entries in /etc/cups/mime.types, CUPS determines the type of data that is submitted. Next, the data is converted to PostScript in all cases. Then the pstops program determines the number of pages the print job has. This leads to a print job that is ready but completely in the PostScript format.

5. Not all printers can handle PostScript. Therefore, in the next step, cupsd starts the appropriate filter to convert the print job to a format that is understood properly by the printer. A generic filter that is often used for this purpose is cupsomatic.

6. After the print job has been formatted in a format that is understood by the printer, the back-end program sends it to the printer. This back-end program is a binary found in /usr/lib/cups/backend and handles communication with a specific type of printer. For example, different back-end programs exist to communicate with USB, SMB, or parallel printers.

7. When the print job has been sent from the print queue to the printer, the CUPS print spooler deletes it from the queue and begins working on the next job.

In this generic overview of the CUPS printing process, you can see that different elements are used. The most important element is the print queue. Every printer has at least one print queue associated with it; however, a printer can have more than one print queue. These print queues are in the file /etc/cups/printers.conf. A specific configuration file is associated with each queue. This file is in the directory /etc/cups/ppd. In this file, printer properties such as the paper size are registered. Then, for compatibility reasons with the legacy LPD-based printing system, the client that uses a printer always has a file called /etc/printcap. In this file, the names of the queues are registered. This file provides a universal printing interface to different applications that need to print.

When setting up and tuning the CUPS print process, it is also important to know where to find the CUPS log files. Three log files are created by default: access_log, error_log, and page_log. You can find all of them in /var/log/cups. The access_log file allows you to see which clients have accessed printers at which times. The page_log file lists all the pages that were sent to the printer, and error_log lists all errors and warnings that occurred. This is the file to check when you are having problems accessing printers.

Was this article helpful?

0 0

Post a comment