7.2

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.
5.
Set the permissions on the input filter file so that it can be executed from root. Use the chmod command as follows, replac-
ing mailing.scr with the name of your input filter file:
chmod 755 /var/spool/lpd/mailing.scr
6. Edit the printcap file to add the input filter to the queue definition. Your entry should now look like this:
mailing:\
:sd=/var/spool/lpd/mailing:\
:mx#0:\
:sh:\
:lp=/dev/lp1:\
:if=/var/spool/lpd/mailing.scr:
It is important to add a backslash to a line before adding a new line, and to add a colon at the end of each new line.
7. Save the changes and exit the printcap file.
You have created your trigger. To print data on the MAILING document, use the queue "mailing". For example:
lpr -Pmailing data.txt
To create a printcap entry by hand:
1. Open the /etc/printcap file with a text editor. For example, you might open it with the vi text editor by issuing the
command
vi /etc/printcap
2.
Enter the following at the end of the /etc/printcap file. Change the queue name and spool directory to reflect your instal-
lation. This printcap entry is for a text-only printer on device lp1 named mailing, that uses the spool directory
/var/spool/lpd/mailing.
Creating Triggers
©2014 Objectif Lune Inc - 37 -