6.0

Detailed Directions
47
Implement a Trigger under BSD Printing Systems (BSDi, FreeBSD, Linux)
The procedure here describes trigger implementation for UNIX systems using a BSD-like printing system
(lpr, lpq, /etc/printcap). It assumes you are logged on as root.
To install a BSD printing system:
1. Create a text-only print queue entry in /etc/printcap and a spool directory.
If your system has a tool to create a print queue, use it to create a text-only queue. Make sure no input
filter is used (i.e. there is no if: command in the printcap entry). If you do not have such a tool, you must
create the printcap entry and a spool directory by hand. See “To create a printcap entry by hand:” on
page 48 and “To create a spool directory by hand:” on page 49.
2. Create an input filter for the trigger. The input filter is a shell script that inserts the trigger in front of
the print job. You should give the script the name of the document. In this example, we have a
document named MAILING on the hard disk of the printer. We name the script mailing.scr and place it
in the spool directory.
3. Edit the input filter using a text editor. For example, to edit it in the vi text editor, we issue the
command:
vi /var/spool/lpd/mailing.scr
Enter the following lines in the text editor:
#!/bin/sh
/bin/echo "%!PS-Adobe"
/bin/echo "(MAILING) run MAILING"
cat -
/bin/echo -e \004
The first echo turns the printer to PS mode. The second echo calls the document. Edit them to reflect
the name and location of your document. Enter all other lines exactly as shown above. Although the
echo \004 is not required, it is recommended as it signals the end of the job to the PostScript printer.
Be sure you use the echo program, and not the command internal to your shell. The echo internal to
your shell might not support the escape characters the echo program supports. The echo program is
usually located in /bin.
4. Save your changes and exit the text editor.