Creating printer interface scripts
If you have a printer that is not supported by adding an entry
to the terminfo
database, or if your printing needs are not
supported by the standard or other interface scripts
provided in the /etc/lp/model file, you can create your
own printer interface script.
To create a customized interface script, do the following:
To specify
that fault messages be sent to the print service, use the lp.tell command.
The standard printer interface code calls the lp.tell command
with the LPTELL
shell variable. The lp.tell program
sends its standard input to the print service. The print service forwards
the message as an alert to the administrator. If its standard input is empty, lp.tell does
not initiate an alert. Examine the code immediately following these comments
in the standard interface script for an example of how
to use the lp.tell (LPTELL) program:
# Here's where we set up the $LPTELL program to capture
# fault messages.
#
# Here's where we print the file.
With the special exit code 129 or lp.tell, the interface script need not disable the printer itself. Your interface script can disable the printer directly, but doing so overrides the fault-alerting mechanism. Alerts are sent only if the print service detects that the printer has faulted, and the special exit code and lp.tell program are its main detection tools.
If the print service must interrupt the printing of a file at any time, it kills the interface script with a signal 15 (see the signal command and the kill command for more information).
If the interface script stops upon from receipt of any other signal, the print service assumes that future print jobs are not affected and continues to use the printer. The print service notifies the person who submitted the print job that the job did not finish successfully.
The signals SIGHUP, SIGINT, SIGQUI, and SIGPIP (trap numbers 1, 2, 3, and 13) are ignored when the interface is invoked. The standard interface script changes this to trap these signals at appropriate times, interprets these signals to mean that the printer has a problem, and issues a fault.