root / tea4cups / trunk / tea4cups.conf @ 3478

Revision 3478, 9.0 kB (checked in by jerome, 15 years ago)

Changed copyright years.

  • Property svn:keywords set to Auth Date Id Rev
RevLine 
[571]1# $Id$
2#
[576]3# Tea4CUPS : Tee for CUPS
[571]4#
[3478]5# (c) 2005-2009 Jerome Alet <alet@librelogiciel.com>
[644]6# (c) 2005 Peter Stuge <stuge-tea4cups@cdy.org>
[571]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.
[645]11#
[571]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.
[645]16#
[571]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
[644]19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
[571]20#
[645]21#
[577]22
[675]23
24
[577]25# First we set all top-level directives in the [global] section
[571]26[global]
[577]27
[659]28
[675]29
[577]30# Should we log debugging information to CUPS' error_log file ?
31# defaults to No if unset.
[571]32debug : yes
[577]33
[659]34
[675]35
[580]36# In which directory will we create our files ? It must already exist !
[577]37# This directive MUST be present since there's no sane default value.
[580]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.
[675]41#
[598]42# directory : /var/spool/tea4cups/
[577]43directory : /var/spool/cups/
44
[659]45
[675]46
[644]47# Should Tea4CUPS keep the files it creates once all hooks have ended ?
[580]48# Defaults to No if unset, meaning that files are automatically deleted
[644]49# once all hooks have ended.
[580]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.
[577]53# BEWARE : this may use huge amounts of disk space !
[675]54#
[580]55# keepfiles : yes
[577]56
[659]57
[675]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
[3438]69#               the backend accepts all the datas without error.
[675]70#
71#           S : delay in Seconds between two attempts.
72#
73# The example below would retry up to three times, at 60 seconds interval.
[3438]74#
[675]75# retry : 3,60
76
77
78
[659]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.
[675]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#
[659]87# onfail : echo "Original Backend failed" | /usr/bin/mail -s Tea4CUPS root
88
89
[675]90
[3438]91# Should we pass incoming datas through a filter command
[659]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.
[3438]98#
[659]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
[675]106
[644]107# Should we serialize the launch of all hooks : launch one after
[580]108# the other to save some system resources.
[644]109# Defaults to No if unset, meaning that all hooks are launched in
[580]110# parallel.
[598]111#
[645]112# NB : in any case, hooks' names are sorted alphabetically and
[598]113# are launched in this sort order (obviously when launched in parallel
114# this is unnoticeable).
[645]115#
[580]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.
[675]119#
[580]120# serialize : yes
121
[659]122
[675]123
[659]124# When executing the contents of a prehook or posthook directive, as
[3438]125# defined below, tea4cups makes the following environment variables
[659]126# available to your own commands :
[577]127#
[659]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?????)
[577]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
[615]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.
[645]147
[659]148
[675]149
[648]150# Some prehooks and posthooks
[597]151#
[645]152# Prehooks are guaranteed to be launched
153# BEFORE the job's datas are sent to the printer, and
[597]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.
[648]162# If defined, the normal value is 0, meaning that the real CUPS backend exited
[597]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.
[645]166#
[597]167# prehook_0 : echo "Your print job has been accepted" | smbclient -M $TEAUSERNAME
[598]168# posthook_0 : echo "Your print job has been printed with status $TEASTATUS" | smbclient -M $TEAUSERNAME
[601]169#
[645]170# NB : as a special feature, any prehook which exits with a -1 status (255)
[602]171# causes the job to NOT be sent to the real backend, effectively cancelling it.
[645]172# None of the posthooks gets executed in this case, but all
[602]173# remaining prehooks are still executed.
[645]174#
[644]175#posthook_0 : cat $TEADATAFILE >/tmp/$TEAJOBID.prn
[597]176
177
[675]178
[678]179# Another example : a PDF generator which creates PDF documents
[3438]180# in the user's home directory under the names JOB-iiii.pdf
[678]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"
[682]187#
188# The posthook below will log all error or warning messages sent by ps2pdf
[684]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.
[682]191#
192# posthook_rawpdf : /bin/cat >/tmp/log_of_pdf_creation_for_job_$TEAJOBID
[678]193
194
195
[571]196# Sample section for print queue HP2100
197# Uncomment and adapt to your needs.
198#
[580]199#[HP2100]
[571]200#
[644]201# By using a same hook name as in the [global] section, the new
[580]202# value takes precedence
[675]203#
[678]204#posthook_0 : cat $TEADATAFILE >/tmp/$TEAUSERNAME-$TEAJOBID.prn
[598]205
[659]206
[675]207
[580]208# An empty value deletes a value defined in the [global] section
[644]209# so this particular hook doesn't get executed on this printer.
[675]210#
[678]211#prehook_rawpdf :
[598]212
[659]213
[675]214
[580]215# A reflector which produces 4 copies each time :
[675]216#
[681]217#posthook_4copies : lp -dotherprinter -n4 $TEADATAFILE
[598]218
[659]219
[675]220
[645]221# A simple accounting mechanism
[675]222#
[666]223#prehook_accounting : echo $TEAPRINTERNAME $TEAJOBID $TEAUSERNAME $TEABILLING `pkpgcounter $TEADATAFILE` >>/var/log/printaccounting.log
[598]224
[659]225
[620]226# Some additionnal hooks to forbid duplicate jobs :
227# The prehook will use the history file to filter out duplicate jobs
[645]228# checkdupes is an hypothetical command which exits -1 if the current print
[648]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
[3438]233# if they differ only by the value of the '%%CreationDate:' PostScript
[648]234# comment !
[675]235#
[620]236#prehook_to_filter_duplicates : /usr/local/bin/checkdupes $TEAMD5SUM /tmp/jobmd5sums
237#posthook_to_filter_duplicates : echo "$TEAJOBID : $TEAMD5SUM" >>/tmp/jobmd5sums
[648]238
[659]239
[675]240
[648]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.