Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My issue: When an order is processed, the same document needs to be printed on two printers.

My proposed solution: Create a single queue in CUPS with a backend script that spits the job out to the two real printers queues.

My problem: Documentation. Maybe I'm looking at every ring around the bullseye, but I can't find anything that lays out the rules for writing a CUPS backend script.

In the end, I have several questions:

  • Is there already an option to do this in CUPS that I've missed?
  • The line I use to add my queue is "lpadmin -p MultiPass -E -v multipass -P Generic PostScript Printer". But DeviceURI is bad unless I specify a directory like "-v multipass:/tmp". Why is this?
  • For testing, my script does nothing but capture ARGV and write it out to a text file one line per argument. Problem is, I'm getting nothing. Logs show the job as successful, but I'm pretty sure my meager attempt at a backend isn't even being run.

I've tried to keep this question brief, so please ask for more info as I'm sure I've left out the most important part in all this. Honestly, I'm just done chasing my own tail. Thank you for your time.

share|improve this question
2  
Post your test backend, please. Your question is made of teh funny, btw, but I won't say why. –  Dennis Williamson Jun 19 '09 at 0:46
    
My current, meager, test code can be seen at: gist.github.com/132333 Funny? Why I don't know what you could mean. /wink –  Shazburg Jun 19 '09 at 1:16
1  
The -v option is a URI, so in that context your backend "multipass" is analogous to a protocol (such as http). So you need a path after it (just like a URL contains a path). If you run "lpstat -t" does it show the jobs that you submitted for testing as still pending? –  Dennis Williamson Jun 19 '09 at 3:36
    
On the URI... I see. That helps. No jobs are pending. In fact, CUPS reports them as completing successfully. –  Shazburg Jun 19 '09 at 3:46

2 Answers 2

up vote 1 down vote accepted

Here's another approach. It uses a shell script to print the document once for each printer and sets up that script as the interface.

#!/bin/bash 
# if you don't have bash, use /bin/sh 
# don't leave off the first line - absolutely needed for cups! 
/usr/bin/lp -dprinter1  $6 
/usr/bin/lp -dprinter2  $6 
/usr/bin/lp -dprinter3  $6

chmod 755 ~/myinterfacefile 
lpadmin -p threeprint -E  -i ~/myinterfacefile -v /dev/null

Sending jobs to "threeprint" (lp -d threeprint somefile) will now print on all three printers.

share|improve this answer
    
Worked like a charm. Took all of 5 minutes to setup and test. Thank you so very much! –  Shazburg Jun 19 '09 at 7:02

I found a backend called Tea4Cups which is available here. You can poke around in the SVN tree and find earlier versions or a later one.

The possibilities are endless :

  • Send the same job to several printers at the same time, which is not possible with CUPS.
  • Automate the PDF archiving of all print jobs.
  • Forbid duplicate print jobs (a simple example is shown in the sample configuration file)
  • Create a print accounting solution in 15 minutes ( YES, THIS IS FOR REAL )
  • etc...

This page explains the difference between purchasing this script and downloading it for free.

share|improve this answer
    
Here is a product that purports to do this for Windows: lpr.brooksnet.com/broadcast-printing.html –  Dennis Williamson Jun 19 '09 at 4:35
    
Spent a few hours on Tea4Cups and came up with a lot of errors and too little documentation. That said, it seems like a very cool backend and one I will keep in my back pocket for another project. –  Shazburg Jun 19 '09 at 7:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.