root / tea4cups / trunk / tea4cups.conf @ 674

Revision 674, 7.5 kB (checked in by jerome, 18 years ago)

Changed the copyright years.

  • 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
23# First we set all top-level directives in the [global] section
[571]24[global]
[577]25
[659]26
[577]27# Should we log debugging information to CUPS' error_log file ?
28# defaults to No if unset.
[571]29debug : yes
[577]30
[659]31
[580]32# In which directory will we create our files ? It must already exist !
[577]33# This directive MUST be present since there's no sane default value.
[580]34# Can be set either in the [global] section or any print queue section.
35# The value defined in a print queue section takes precedence over the
36# value defined in the [global] section.
[598]37# directory : /var/spool/tea4cups/
[577]38directory : /var/spool/cups/
39
[659]40
[644]41# Should Tea4CUPS keep the files it creates once all hooks have ended ?
[580]42# Defaults to No if unset, meaning that files are automatically deleted
[644]43# once all hooks have ended.
[580]44# Can be set either in the [global] section or any print queue section.
45# The value defined in a print queue section takes precedence over the
46# value defined in the [global] section.
[577]47# BEWARE : this may use huge amounts of disk space !
[580]48# keepfiles : yes
[577]49
[659]50
51# Should we launch some command when the real CUPS backend fails ?
52# Can be set either in the [global] section or any print queue section.
53# The value defined in a print queue section takes precedence over the
54# value defined in the [global] section.
55# onfail : echo "Original Backend failed" | /usr/bin/mail -s Tea4CUPS root
56
57
58# Should we pass incoming datas through a filter command
59# BEFORE doing anything else ?
60# NB : obvisouly the filter command doesn't have any access to
61#      the environment variables defined below.
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# The sample filter below can remove the print job creation date
67# from PostScript jobs, in order to more accurately detect duplicate
68# jobs (so the MD5SUM would be identical from launch to launch)
69#
70# filter : /bin/grep -v "%%CreationDate:"
71
72
[644]73# Should we serialize the launch of all hooks : launch one after
[580]74# the other to save some system resources.
[644]75# Defaults to No if unset, meaning that all hooks are launched in
[580]76# parallel.
[598]77#
[645]78# NB : in any case, hooks' names are sorted alphabetically and
[598]79# are launched in this sort order (obviously when launched in parallel
80# this is unnoticeable).
[645]81#
[580]82# Can be set either in the [global] section or any print queue section.
83# The value defined in a print queue section takes precedence over the
84# value defined in the [global] section.
85# serialize : yes
86
[659]87
88# When executing the contents of a prehook or posthook directive, as
89# defined below, tea4cups makes the following environment variables
90# available to your own commands :
[577]91#
[659]92#      TEAPRINTERNAME : The print queue name.
93#      TEADIRECTORY : Tea4CUPS output directory.
94#      TEADATAFILE : Full name of Tea4CUPS work file (in $TEADIRECTORY).
95#      TEAJOBSIZE : Job's size in bytes.
96#      TEAMD5SUM : MD5 sum of the job's datas.
97#      TEACLIENTHOST : Client's hostname or IP address.
98#      TEAJOBID : Job's Id.
99#      TEAUSERNAME : Name of the user who launched the print job.
100#      TEATITLE : Job's title.
101#      TEACOPIES : Number of copies requested.
102#      TEAOPTIONS : Options of the print job.
103#      TEAINPUTFILE : Job's data file or empty when job read from stdin.
104#      TEABILLING : Job's billing code (lp -o job-billing=SomeCode file.ps)
105#      TEACONTROLFILE : Job's IPP message file (usually /var/spool/cups/c?????)
[577]106#
107# Your own commands will mostly be interested in TEADATAFILE which is
108# the name of the file from which your commands may extract the final
[615]109# job's datas. Don't rely on TEAINPUTFILE, use TEADATAFILE instead
110# since the first one may be empty depending on your printer driver.
[645]111
[659]112
[648]113# Some prehooks and posthooks
[597]114#
[645]115# Prehooks are guaranteed to be launched
116# BEFORE the job's datas are sent to the printer, and
[597]117# posthooks are guaranteed to be launched AFTER the job's
118# datas have been sent to the printer.
119#
120# prehook names are completely free BUT THEY MUST BEGIN WITH 'prehook_'
121# posthook names are completely free BUT THEY MUST BEGIN WITH 'posthook_'
122#
123# An additionnal environment variable is made available to posthooks,
124# named TEASTATUS which contains the exitcode of the real CUPS backend.
[648]125# If defined, the normal value is 0, meaning that the real CUPS backend exited
[597]126# successfully. Any other value indicates that a problem occured
127# in the CUPS backend which handles the transmission of the job
128# to the printer.
[645]129#
[597]130# prehook_0 : echo "Your print job has been accepted" | smbclient -M $TEAUSERNAME
[598]131# posthook_0 : echo "Your print job has been printed with status $TEASTATUS" | smbclient -M $TEAUSERNAME
[601]132#
[645]133# NB : as a special feature, any prehook which exits with a -1 status (255)
[602]134# causes the job to NOT be sent to the real backend, effectively cancelling it.
[645]135# None of the posthooks gets executed in this case, but all
[602]136# remaining prehooks are still executed.
[645]137#
[644]138#prehook_pdf : cat $TEADATAFILE | su -c "lp -dPDFGenerator" $TEAUSERNAME
139#posthook_0 : cat $TEADATAFILE >/tmp/$TEAJOBID.prn
[597]140
141
[571]142# Sample section for print queue HP2100
143# Uncomment and adapt to your needs.
144#
[580]145#[HP2100]
[571]146#
[644]147# By using a same hook name as in the [global] section, the new
[580]148# value takes precedence
[644]149#posthook_0 : cat $TEADATAFILE >~$TEAUSERNAME/savejobs/$TEAJOBID.prn
[598]150
[659]151
[580]152# An empty value deletes a value defined in the [global] section
[644]153# so this particular hook doesn't get executed on this printer.
[645]154#prehook_pdf :
[598]155
[659]156
[580]157# A reflector which produces 4 copies each time :
[645]158#posthook_4copies : lp -dotherprinter -n4 $CUPSDATAFILE
[598]159
[659]160
[645]161# A simple accounting mechanism
[666]162#prehook_accounting : echo $TEAPRINTERNAME $TEAJOBID $TEAUSERNAME $TEABILLING `pkpgcounter $TEADATAFILE` >>/var/log/printaccounting.log
[598]163
[659]164
[620]165# Some additionnal hooks to forbid duplicate jobs :
166# The prehook will use the history file to filter out duplicate jobs
[645]167# checkdupes is an hypothetical command which exits -1 if the current print
[648]168# job is a duplicate (same MD5 sum already found in history).
169#
170# NB : Beware of some software which embed the job printing time into the
171# PostScript job : two identical jobs may have different MD5 checksums
172# if they differ only by the value of the '%%CreationDate:' PostScript
173# comment !
[620]174#prehook_to_filter_duplicates : /usr/local/bin/checkdupes $TEAMD5SUM /tmp/jobmd5sums
175#posthook_to_filter_duplicates : echo "$TEAJOBID : $TEAMD5SUM" >>/tmp/jobmd5sums
[648]176
[659]177
[648]178# A particular prehook can send datas to the posthook
179# of the same name automatically through pipes :
180# The file /tmp/result1 will contain the output of prehook_dialog1
181# prehook_dialog1 : echo "This is pipe #1"
182# posthook_dialog1 : cat >/tmp/result1
183# The file /tmp/result2 will contain the output of prehook_dialog2
184# prehook_dialog2 : echo "This is pipe #2"
185# posthook_dialog2 : cat >/tmp/result2
Note: See TracBrowser for help on using the browser.