System Administration Guide: Solaris Printing

Exit Codes

When printing is complete, your interface program should exit with a code that shows the status of the print job. The exit code is the last entry in the printer interface program.

The following table shows the exit codes and how they are interpreted by the LP print service.

Table 7–6 Printer Interface Program Exit Codes

Exit Code 

Meaning to the LP Print Service 

0

The print request has been successfully completed. If a printer fault occurred, it has been cleared. 

1 to 127

A problem was encountered when printing a request. For example, there were too many nonprintable characters or the request exceeds the printer's capabilities. The LP print service notifies the person who submitted the request that an error occurred when printing it. This error does not affect future print requests. If a printer fault has occurred, it has been cleared. 

128

This code is reserved for use by the LP print service. Interface programs must not exit with this code. 

129

A printer fault was encountered when printing the request. This fault does affect future print requests. If the fault recovery for the printer directs the LP print service to wait for the administrator to correct the problem, the LP print service disables the printer. If the fault recovery is to continue printing, the LP print service does not disable the printer. However, the print service will try printing again in a few minutes. 

>129

These codes are reserved for use by the LP print service. Interface programs must not exit with codes in this range. 

If the program exits with a code of 129, root is alerted of a printer fault. The LP print service must also reprint the request from the beginning, after the fault has been cleared. If you do not want the entire request to be reprinted, you can have the interface program send a fault message to the LP print service. (First wait for the fault to be cleared.) When the fault is cleared, the interface program can resume printing the file. When printing is finished, the printer interface program can give a 0 exit code, just as if the fault had never occurred. An added advantage of this approach: The interface program can detect when the fault is cleared automatically. Thus, the administrator does not need to re-enable the printer.