Operating System - HP-UX
1838250 Members
4639 Online
110125 Solutions
New Discussion

How to print one job to two printers from the command line?

 
SOLVED
Go to solution
Jim Johnson_8
Occasional Contributor

How to print one job to two printers from the command line?

I've tried:
banner HELLO |lp -dlp1 -dlp2
which would have been the easiest implementation, but alas it does not work.
I've tried:
banner HELLO |lp -dlp1 |lp -dlp2
but it didn't like that either.
I haven't seen this solved in the forums yet; I did see a reference to using the tee command, but no examples.
I would like to get this working from the command line if possible (no scripting).

Thanks,
Jim

OS version and shell doesn't appear to matter and I'm just using the general HP-UX lp scheduler.
5 REPLIES 5
S.K. Chan
Honored Contributor

Re: How to print one job to two printers from the command line?

What about...
$ for i in 1 2
>do
>banner HELLO | lp -dlp$i
>done
$
Running this from the command line, I don't know if you would call this scripting or not. Just ignore if this is not what you're looking for.
Jeff Schussele
Honored Contributor

Re: How to print one job to two printers from the command line?

Hi Jim,

Why mess around with a command line kludge?

I tested this & it works.

Create a "third" printer that points to one of them - doesn't matter which. And then edit the interface for this "printer" and add the command that will send the request to the other as well.
This will cause the single print request to that "printer" to go to both.

In this case both were remote printers & I added the lp -dlp2 $1 just ahead of the rlp command line that was sending to lp1.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Rory R Hammond
Trusted Contributor
Solution

Re: How to print one job to two printers from the command line?

This is ugly, but it will catch an input stream.

echo hello |tee frag|lp -d prt1;lp -d prt2 < frag;rm frag
request id is prt1-96 (standard input)
request id is prt2-97 (standard input)
There are a 100 ways to do things and 97 of them are right
MANOJ SRIVASTAVA
Honored Contributor

Re: How to print one job to two printers from the command line?

easiet implenatation :


banner hello | lp -dlp1 ; banner hello | lp -dlp2


lp -dlp1 will take only one input at a tie and also in the second try the /op of the first line become the input for the sencond so it wont work either .



Manoj Srivastava
Jim Johnson_8
Occasional Contributor

Re: How to print one job to two printers from the command line?

All replies worked.

Rory's suggestion was the one that fit best with what I was trying to do.
Jeff's suggestion was really good as well, but assumes root access.
Manoj, the problem with that one assumes you are in control of what gets printed.
The banner HELLO was just an example, I'm not actually in control of that part in our application.

Thanks for all the suggestions.

HP please allow multiple -d switches!