Operating System - HP-UX
1820605 Members
1741 Online
109626 Solutions
New Discussion юеВ

Report to two printers via 'lp'?

 
SOLVED
Go to solution
Brad Marks
Super Advisor

Report to two printers via 'lp'?

Is there a way to send a lp job to multiple destiination queues? (e.g.: lp -dp1 -dp2...)?

Weird, but they want it!
It's not impossible -- it'll just cost more...
9 REPLIES 9
John Poff
Honored Contributor
Solution

Re: Report to two printers via 'lp'?

Hi,

This question came up a few weeks ago. There were a couple of good answers, but the poster decided to use the 'tee' command to shoot the job to two printers at once.

JP

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6ad0a848deccd61190050090279cd0f9,00.html

A. Clay Stephenson
Acclaimed Contributor

Re: Report to two printers via 'lp'?

Not directly but you can always create a wrapper script
(e.g. lp.sh) that parses the command line and sends multiple -d arguments to separate lp commands. It gets more difficult if you have to read stdin. In that case you would have to read stdin into a temp file and then send the temp file to the multiple lp commands and finally remove the temp file.

If it ain't broke, I can fix that.
Brad Marks
Super Advisor

Re: Report to two printers via 'lp'?

The problem with all of the above is that users are running BusinessBasic (BB) on the HP box. BB requires an alias defined for each printer. Here's an example of an alias entry:
alias P1 ">lp -dlp1 -s 2>/dev/null"

There doesn't seem a workable way to use the tee command.
I also tried Jeff Schussele's approach (create a third printer that points to both p1 and p2), but I couldn't find any references to the printers -- Jeff's were remote printers mine are networked printers.

Any further suggestions would be greatly appreciated.

Brad
It's not impossible -- it'll just cost more...
Jeff Schussele
Honored Contributor

Re: Report to two printers via 'lp'?

Hi (again) Brad,

Try this.
Set up that "third" printer as a remote printer for example call it new_ptr_name. Specify either of the actual IPs/queunames used by the JetDirect cards.
Doesn't really matter if you have either of those correct....because....
You're going to edit the /etc/lp/interface/new_ptr_name file &
1) Replace the /usr/sbin/rlp command line with a lp -dlp1 $1 command
2) Add a second lp command lp -dlp2 $1

Then whenever a lp -dnew_ptr_name request is made this script is executed & should produce output on both printers. I haven't tried this as I don't have HPPI to play with...but in theory this should work.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Brad Marks
Super Advisor

Re: Report to two printers via 'lp'?

While I understand what Jeff is suggesting, I can't find an instance of '/usr/sbin/rlp' in the script for the printer. Nor can I figure out where the spool queue names should be specified.

I have attached the /etc/lp/interface/ file. If anyone would like to indicate where in the script I can do what Jeff proposes, I would be greatful.

Thanks,
Brad
It's not impossible -- it'll just cost more...
Jeff Schussele
Honored Contributor

Re: Report to two printers via 'lp'?

Not sure why you get that interface script when you specify a remote printer.
But check to see if you have this file

/usr/lib/lp/model/rmodel

This is the default remote printer model.

If so copy it into /etc/lp/interface & give it the new_ptr_name as a filename THEN you can edit it as I earlier mentioned.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Brad Marks
Super Advisor

Re: Report to two printers via 'lp'?

Jeff,
Sorry if I have led you down the wrong path. The printer is not a remote printer; simply a local printer on the network and created via hppi using it's ip address. I guess that's why I'm getting the interface script that I am.
What say U?

Thanks again & again.

Brad
It's not impossible -- it'll just cost more...
Jeff Schussele
Honored Contributor

Re: Report to two printers via 'lp'?

OK...not a problem...I thought maybe that's what you did.

Just remove that "third" network printer & go into SAM to create the new remote printer.

Printers and Plotters -> LP Spooler -> Printers and Plotters -> Actions -> Add Remote Printer/Plotter
For Printer Name => whatever you want it to be known locally
Remote System Name => Give it any IP (Doesn't matter - nothing will be going to "it" anyway)
Remote Printer Name => Give it any name (Again doesn't matter)

Then click ok.
NOW when you check /etc/lp/interface, you should see the proper model script named for that ptr & just edit that as above & test with a normal lp -dnew_ptr_name /path/to/ascii/file & see if you don't get output on both printers.

One caveat - remote printer requests go out raw - with a LF only. You may need to set the ptr(s) to append CR to LF in the Printing Menu to avoid the output "stair stepping" right off the page.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Report to two printers via 'lp'?

Well...come to think of it - they'll be coming back through HPPI - so it should be processed by it just fine.

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!