1 | # $Id$ |
---|
2 | # |
---|
3 | # Tea4CUPS : Tee for CUPS |
---|
4 | # |
---|
5 | # This program is free software; you can redistribute it and/or modify |
---|
6 | # it under the terms of the GNU General Public License as published by |
---|
7 | # the Free Software Foundation; either version 2 of the License, or |
---|
8 | # (at your option) any later version. |
---|
9 | # |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU General Public License for more details. |
---|
14 | # |
---|
15 | # You should have received a copy of the GNU General Public License |
---|
16 | # along with this program; if not, write to the Free Software |
---|
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
18 | # |
---|
19 | # |
---|
20 | |
---|
21 | # First we set all top-level directives in the [global] section |
---|
22 | [global] |
---|
23 | |
---|
24 | # Should we log debugging information to CUPS' error_log file ? |
---|
25 | # defaults to No if unset. |
---|
26 | debug : yes |
---|
27 | |
---|
28 | # In which directory will we create our files ? It must already exist ! |
---|
29 | # This directive MUST be present since there's no sane default value. |
---|
30 | # Can be set either in the [global] section or any print queue section. |
---|
31 | # The value defined in a print queue section takes precedence over the |
---|
32 | # value defined in the [global] section. |
---|
33 | # directory : /var/spool/tea4cups/ |
---|
34 | directory : /var/spool/cups/ |
---|
35 | |
---|
36 | # Should Tea4CUPS keep the files it creates once all tees have ended ? |
---|
37 | # Defaults to No if unset, meaning that files are automatically deleted |
---|
38 | # once all tees have ended. |
---|
39 | # Can be set either in the [global] section or any print queue section. |
---|
40 | # The value defined in a print queue section takes precedence over the |
---|
41 | # value defined in the [global] section. |
---|
42 | # BEWARE : this may use huge amounts of disk space ! |
---|
43 | # keepfiles : yes |
---|
44 | |
---|
45 | # Should we serialize the launch of all tees : launch one tee after |
---|
46 | # the other to save some system resources. |
---|
47 | # Defaults to No if unset, meaning that all tees (or hooks) are launched in |
---|
48 | # parallel. |
---|
49 | # |
---|
50 | # NB : in any case, hooks or tees names are sorted alphabetically and |
---|
51 | # are launched in this sort order (obviously when launched in parallel |
---|
52 | # this is unnoticeable). |
---|
53 | # |
---|
54 | # Can be set either in the [global] section or any print queue section. |
---|
55 | # The value defined in a print queue section takes precedence over the |
---|
56 | # value defined in the [global] section. |
---|
57 | # This value also applies to prehooks and posthooks (see below) |
---|
58 | # serialize : yes |
---|
59 | |
---|
60 | # When executing the contents of a tee, prehook or posthook directive, |
---|
61 | # tea4cups makes the following environment variables available to your |
---|
62 | # own commands : |
---|
63 | # |
---|
64 | # TEAPRINTERNAME : The print queue name. |
---|
65 | # TEADIRECTORY : Tea4CUPS output directory. |
---|
66 | # TEADATAFILE : Full name of Tea4CUPS work file (in $TEADIRECTORY). |
---|
67 | # TEAJOBSIZE : Job's size in bytes. |
---|
68 | # TEAMD5SUM : MD5 sum of the job's datas. |
---|
69 | # TEACLIENTHOST : Client's hostname or IP address. |
---|
70 | # TEAJOBID : Job's Id. |
---|
71 | # TEAUSERNAME : Name of the user who launched the print job. |
---|
72 | # TEATITLE : Job's title. |
---|
73 | # TEACOPIES : Number of copies requested. |
---|
74 | # TEAOPTIONS : Options of the print job. |
---|
75 | # TEAINPUTFILE : Print job's data file or empty when job read from stdin. |
---|
76 | # |
---|
77 | # Your own commands will mostly be interested in TEADATAFILE which is |
---|
78 | # the name of the file from which your commands may extract the final |
---|
79 | # job's datas. |
---|
80 | |
---|
81 | # Now defines some default tees which will always be launched |
---|
82 | # at the same time that the job's datas are being sent to the |
---|
83 | # printer. |
---|
84 | # The tee names are completely free BUT THEY MUST BEGIN WITH 'tee_' |
---|
85 | # |
---|
86 | # These are just some stupid examples. |
---|
87 | #tee_0 : cat $TEADATAFILE >/tmp/$TEAJOBID.prn |
---|
88 | #tee_pdf : cat $TEADATAFILE | su -c "lp -dPDFGenerator" $TEAUSERNAME |
---|
89 | |
---|
90 | # Some hooks : prehooks and posthooks |
---|
91 | # |
---|
92 | # Contrary to tees, prehooks are guaranteed to be launched |
---|
93 | # BEFORE the job's datas are sent to the printer, and |
---|
94 | # posthooks are guaranteed to be launched AFTER the job's |
---|
95 | # datas have been sent to the printer. |
---|
96 | # |
---|
97 | # prehook names are completely free BUT THEY MUST BEGIN WITH 'prehook_' |
---|
98 | # posthook names are completely free BUT THEY MUST BEGIN WITH 'posthook_' |
---|
99 | # |
---|
100 | # An additionnal environment variable is made available to posthooks, |
---|
101 | # named TEASTATUS which contains the exitcode of the real CUPS backend. |
---|
102 | # The normal value is 0, meaning that the real CUPS backend exited |
---|
103 | # successfully. Any other value indicates that a problem occured |
---|
104 | # in the CUPS backend which handles the transmission of the job |
---|
105 | # to the printer. |
---|
106 | # |
---|
107 | # prehook_0 : echo "Your print job has been accepted" | smbclient -M $TEAUSERNAME |
---|
108 | # posthook_0 : echo "Your print job has been printed with status $TEASTATUS" | smbclient -M $TEAUSERNAME |
---|
109 | # |
---|
110 | # NB : as a special feature, any prehook which exits with a -1 status (255) |
---|
111 | # causes the job to NOT be sent to the real backend, effectively cancelling it. |
---|
112 | # None of the tees and posthooks gets executed in this case, but all |
---|
113 | # remaining prehooks are still executed. |
---|
114 | # |
---|
115 | |
---|
116 | |
---|
117 | # Sample section for print queue HP2100 |
---|
118 | # Uncomment and adapt to your needs. |
---|
119 | # |
---|
120 | #[HP2100] |
---|
121 | # |
---|
122 | # By using a same tee name as in the [global] section, the new |
---|
123 | # value takes precedence |
---|
124 | #tee_0 : cat $TEADATAFILE >~$TEAUSERNAME/savejobs/$TEAJOBID.prn |
---|
125 | |
---|
126 | # An empty value deletes a value defined in the [global] section |
---|
127 | # so this particular tee doesn't get executed. |
---|
128 | #tee_pdf : |
---|
129 | |
---|
130 | # A reflector which produces 4 copies each time : |
---|
131 | #tee_4copies : lp -dotherprinter -n4 $CUPSDATAFILE |
---|
132 | |
---|
133 | # A simple accounting mechanism |
---|
134 | #tee_accounting : echo $TEAPRINTERNAME $TEAJOBID $TEAUSERNAME `pkpgcounter $TEADATAFILE` >/var/log/printaccounting.log |
---|
135 | |
---|
136 | # An additionnal posthook : |
---|
137 | #posthook_dummy : echo "$TEAJOBID : $TEAMD5SUM" >>/tmp/jobmd5sums |
---|