root / tea4cups / trunk / tea4cups.conf @ 3576

Revision 3576, 9.0 kB (checked in by jerome, 6 years ago)

Fixed copyright strings and added some credits.

  • Property svn:keywords set to Auth Date Id Rev
Line 
1# $Id$
2#
3# Tea4CUPS : Tee for CUPS
4#
5# (c) 2005-2018 Jerome Alet <alet@librelogiciel.com>
6# (c) 2005 Peter Stuge <stuge-tea4cups@cdy.org>
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20#
21#
22
23
24
25# First we set all top-level directives in the [global] section
26[global]
27
28
29
30# Should we log debugging information to CUPS' error_log file ?
31# defaults to No if unset.
32debug : yes
33
34
35
36# In which directory will we create our files ? It must already exist !
37# This directive MUST be present since there's no sane default value.
38# Can be set either in the [global] section or any print queue section.
39# The value defined in a print queue section takes precedence over the
40# value defined in the [global] section.
41#
42# directory : /var/spool/tea4cups/
43directory : /var/spool/cups/
44
45
46
47# Should Tea4CUPS keep the files it creates once all hooks have ended ?
48# Defaults to No if unset, meaning that files are automatically deleted
49# once all hooks have ended.
50# Can be set either in the [global] section or any print queue section.
51# The value defined in a print queue section takes precedence over the
52# value defined in the [global] section.
53# BEWARE : this may use huge amounts of disk space !
54#
55# keepfiles : yes
56
57
58
59# Should we retry to send the job's datas to the real backend in the case
60# it fails ? The default when not set is to try to send the datas only once
61# to the real backend.
62# Can be set either in the [global] section or any print queue section.
63# The value defined in a print queue section takes precedence over the
64# value defined in the [global] section.
65#
66# Syntax : "retry: N,S"
67#
68#           N : number of times to try. If 0, will retry indefinitely, until
69#               the backend accepts all the datas without error.
70#
71#           S : delay in Seconds between two attempts.
72#
73# The example below would retry up to three times, at 60 seconds interval.
74#
75# retry : 3,60
76
77
78
79# Should we launch some command when the real CUPS backend fails ?
80# Can be set either in the [global] section or any print queue section.
81# The value defined in a print queue section takes precedence over the
82# value defined in the [global] section.
83# IMPORTANT : this directive is only taken into account when the number
84# of tries as defined in the 'retry' directive above have expired and
85# the real backend still fails.
86#
87# onfail : echo "Original Backend failed" | /usr/bin/mail -s Tea4CUPS root
88
89
90
91# Should we pass incoming datas through a filter command
92# BEFORE doing anything else ?
93# NB : obvisouly the filter command doesn't have any access to
94#      the environment variables defined below.
95# Can be set either in the [global] section or any print queue section.
96# The value defined in a print queue section takes precedence over the
97# value defined in the [global] section.
98#
99# The sample filter below can remove the print job creation date
100# from PostScript jobs, in order to more accurately detect duplicate
101# jobs (so the MD5SUM would be identical from launch to launch)
102#
103# filter : /bin/grep -v "%%CreationDate:"
104
105
106
107# Should we serialize the launch of all hooks : launch one after
108# the other to save some system resources.
109# Defaults to No if unset, meaning that all hooks are launched in
110# parallel.
111#
112# NB : in any case, hooks' names are sorted alphabetically and
113# are launched in this sort order (obviously when launched in parallel
114# this is unnoticeable).
115#
116# Can be set either in the [global] section or any print queue section.
117# The value defined in a print queue section takes precedence over the
118# value defined in the [global] section.
119#
120# serialize : yes
121
122
123
124# When executing the contents of a prehook or posthook directive, as
125# defined below, tea4cups makes the following environment variables
126# available to your own commands :
127#
128#      TEAPRINTERNAME : The print queue name.
129#      TEADIRECTORY : Tea4CUPS output directory.
130#      TEADATAFILE : Full name of Tea4CUPS work file (in $TEADIRECTORY).
131#      TEAJOBSIZE : Job's size in bytes.
132#      TEAMD5SUM : MD5 sum of the job's datas.
133#      TEACLIENTHOST : Client's hostname or IP address.
134#      TEAJOBID : Job's Id.
135#      TEAUSERNAME : Name of the user who launched the print job.
136#      TEATITLE : Job's title.
137#      TEACOPIES : Number of copies requested.
138#      TEAOPTIONS : Options of the print job.
139#      TEAINPUTFILE : Job's data file or empty when job read from stdin.
140#      TEABILLING : Job's billing code (lp -o job-billing=SomeCode file.ps)
141#      TEACONTROLFILE : Job's IPP message file (usually /var/spool/cups/c?????)
142#
143# Your own commands will mostly be interested in TEADATAFILE which is
144# the name of the file from which your commands may extract the final
145# job's datas. Don't rely on TEAINPUTFILE, use TEADATAFILE instead
146# since the first one may be empty depending on your printer driver.
147
148
149
150# Some prehooks and posthooks
151#
152# Prehooks are guaranteed to be launched
153# BEFORE the job's datas are sent to the printer, and
154# posthooks are guaranteed to be launched AFTER the job's
155# datas have been sent to the printer.
156#
157# prehook names are completely free BUT THEY MUST BEGIN WITH 'prehook_'
158# posthook names are completely free BUT THEY MUST BEGIN WITH 'posthook_'
159#
160# An additionnal environment variable is made available to posthooks,
161# named TEASTATUS which contains the exitcode of the real CUPS backend.
162# If defined, the normal value is 0, meaning that the real CUPS backend exited
163# successfully. Any other value indicates that a problem occured
164# in the CUPS backend which handles the transmission of the job
165# to the printer. See the output of 'man backend' for details.
166#
167# prehook_0 : echo "Your print job has been accepted" | smbclient -M $TEAUSERNAME
168# posthook_0 : echo "Your print job has been printed with status $TEASTATUS" | smbclient -M $TEAUSERNAME
169#
170# NB : as a special feature, any prehook which exits with a -1 status (255)
171# causes the job to NOT be sent to the real backend, effectively cancelling it.
172# None of the posthooks gets executed in this case, but all
173# remaining prehooks are still executed.
174#
175#posthook_0 : cat $TEADATAFILE >/tmp/$TEAJOBID.prn
176
177
178
179# Another example : a PDF generator which creates PDF documents
180# in the user's home directory under the names JOB-iiii.pdf
181# where iiii is the job id :
182#
183# Beware : using ~$TEAUSERNAME here doesn't work because the ~ is not expanded.
184# NB : for this to work you might have to print with 'lp -o raw'
185#
186# prehook_rawpdf : /bin/cat $TEADATAFILE | su $TEAUSERNAME -c "ps2pdf - `/usr/bin/getent passwd $TEAUSERNAME | /usr/bin/cut -f 6,6 -d :`/JOB-$TEAJOBID.pdf"
187#
188# The posthook below will log all error or warning messages sent by ps2pdf
189# to a job specific file in /tmp/. See the explanation on how pre and post
190# hooks can communicate at the end of this sample configuration file.
191#
192# posthook_rawpdf : /bin/cat >/tmp/log_of_pdf_creation_for_job_$TEAJOBID
193
194
195
196# Sample section for print queue HP2100
197# Uncomment and adapt to your needs.
198#
199#[HP2100]
200#
201# By using a same hook name as in the [global] section, the new
202# value takes precedence
203#
204#posthook_0 : cat $TEADATAFILE >/tmp/$TEAUSERNAME-$TEAJOBID.prn
205
206
207
208# An empty value deletes a value defined in the [global] section
209# so this particular hook doesn't get executed on this printer.
210#
211#prehook_rawpdf :
212
213
214
215# A reflector which produces 4 copies each time :
216#
217#posthook_4copies : lp -dotherprinter -n4 $TEADATAFILE
218
219
220
221# A simple accounting mechanism
222#
223#prehook_accounting : echo $TEAPRINTERNAME $TEAJOBID $TEAUSERNAME $TEABILLING `pkpgcounter $TEADATAFILE` >>/var/log/printaccounting.log
224
225
226# Some additionnal hooks to forbid duplicate jobs :
227# The prehook will use the history file to filter out duplicate jobs
228# checkdupes is an hypothetical command which exits -1 if the current print
229# job is a duplicate (same MD5 sum already found in history).
230#
231# NB : Beware of some software which embed the job printing time into the
232# PostScript job : two identical jobs may have different MD5 checksums
233# if they differ only by the value of the '%%CreationDate:' PostScript
234# comment !
235#
236#prehook_to_filter_duplicates : /usr/local/bin/checkdupes $TEAMD5SUM /tmp/jobmd5sums
237#posthook_to_filter_duplicates : echo "$TEAJOBID : $TEAMD5SUM" >>/tmp/jobmd5sums
238
239
240
241# A particular prehook can send datas to the posthook
242# of the same name automatically through pipes :
243# The file /tmp/result1 will contain the output of prehook_dialog1
244# prehook_dialog1 : echo "This is pipe #1"
245# posthook_dialog1 : cat >/tmp/result1
246# The file /tmp/result2 will contain the output of prehook_dialog2
247# prehook_dialog2 : echo "This is pipe #2"
248# posthook_dialog2 : cat >/tmp/result2
Note: See TracBrowser for help on using the browser.