root / tea4cups / trunk / tea4cups.conf @ 675

Revision 675, 8.3 kB (checked in by jerome, 18 years ago)

Added empty lines to ease readability.
Added support for a 'retry' directive.

  • Property svn:keywords set to Auth Date Id Rev
RevLine 
[571]1# $Id$
2#
[576]3# Tea4CUPS : Tee for CUPS
[571]4#
[674]5# (c) 2005, 2006 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
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
[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
[659]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
[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
125# defined below, tea4cups makes the following environment variables
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#prehook_pdf : cat $TEADATAFILE | su -c "lp -dPDFGenerator" $TEAUSERNAME
176#posthook_0 : cat $TEADATAFILE >/tmp/$TEAJOBID.prn
[597]177
178
[675]179
[571]180# Sample section for print queue HP2100
181# Uncomment and adapt to your needs.
182#
[580]183#[HP2100]
[571]184#
[644]185# By using a same hook name as in the [global] section, the new
[580]186# value takes precedence
[675]187#
[644]188#posthook_0 : cat $TEADATAFILE >~$TEAUSERNAME/savejobs/$TEAJOBID.prn
[598]189
[659]190
[675]191
[580]192# An empty value deletes a value defined in the [global] section
[644]193# so this particular hook doesn't get executed on this printer.
[675]194#
[645]195#prehook_pdf :
[598]196
[659]197
[675]198
[580]199# A reflector which produces 4 copies each time :
[675]200#
[645]201#posthook_4copies : lp -dotherprinter -n4 $CUPSDATAFILE
[598]202
[659]203
[675]204
[645]205# A simple accounting mechanism
[675]206#
[666]207#prehook_accounting : echo $TEAPRINTERNAME $TEAJOBID $TEAUSERNAME $TEABILLING `pkpgcounter $TEADATAFILE` >>/var/log/printaccounting.log
[598]208
[659]209
[620]210# Some additionnal hooks to forbid duplicate jobs :
211# The prehook will use the history file to filter out duplicate jobs
[645]212# checkdupes is an hypothetical command which exits -1 if the current print
[648]213# job is a duplicate (same MD5 sum already found in history).
214#
215# NB : Beware of some software which embed the job printing time into the
216# PostScript job : two identical jobs may have different MD5 checksums
217# if they differ only by the value of the '%%CreationDate:' PostScript
218# comment !
[675]219#
[620]220#prehook_to_filter_duplicates : /usr/local/bin/checkdupes $TEAMD5SUM /tmp/jobmd5sums
221#posthook_to_filter_duplicates : echo "$TEAJOBID : $TEAMD5SUM" >>/tmp/jobmd5sums
[648]222
[659]223
[675]224
[648]225# A particular prehook can send datas to the posthook
226# of the same name automatically through pipes :
227# The file /tmp/result1 will contain the output of prehook_dialog1
228# prehook_dialog1 : echo "This is pipe #1"
229# posthook_dialog1 : cat >/tmp/result1
230# The file /tmp/result2 will contain the output of prehook_dialog2
231# prehook_dialog2 : echo "This is pipe #2"
232# posthook_dialog2 : cat >/tmp/result2
Note: See TracBrowser for help on using the browser.