1844033 Members
2668 Online
110226 Solutions
New Discussion

Re: lp queue duplication

 
SOLVED
Go to solution
Dave Parker
Occasional Advisor

lp queue duplication

I am wanting to set up another lp destination for testing a report distribution database. I would like to capture everything that is sent to one lp destination, to be sent to this new destination also. Is there an easy way of doing this?
The only thing I can come up with is renaming the lp command and writing a shell script in the place of lp that just checks looks for the destination and lp's it to the additional destination if it's a match.
I would prefer not to do this if there is a better way.

Any suggestions?

Thanks,

Dave Parker
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: lp queue duplication

It should be quite easy to modify the printer's interface file to send the file not only to the original printer but to also send the file to another printer.
If it ain't broke, I can fix that.
S.K. Chan
Honored Contributor

Re: lp queue duplication

.. or ..
Setup a printer class spool by including more than one printer to this class. When you print to the class it'll be printed to whatever printer you have defined in that class.
Chris Vail
Honored Contributor

Re: lp queue duplication

Try the 'tee' command. Do a man on it, but the basic command would be "lp $FILE|tee -a $OTHERFILE".


Chris
Dave Parker
Occasional Advisor

Re: lp queue duplication

I don't believe setting up a class will work as that will only send it to the first available printer in the class.
I had considered the tee command, but I cannot change the lp commands issues as there are thousands of them embedded in programs and scripts. Also, many reports originate on other systems (NT & AS/400).

I think that modifying the interface file sounds like a good option. I am presuming I just need to capture the option specified and re-lp it with thos options to my other destination?

Thanks,

Dave.
A. Clay Stephenson
Acclaimed Contributor

Re: lp queue duplication

Yes that is how you would do it. Here are the arguments to the interface:
$1 - Printer Name
$2 - Request ID
$3 - User
$4 - Title (optional - may be "-")
$5 - Number of copies
$6 - options

The remaining args are the pathnames of the files to print. You should probably make copies of these files early in the process because the originals will be removed when the print job is finsished.
If it ain't broke, I can fix that.
Jose Mosquera
Honored Contributor

Re: lp queue duplication

Hi,

What about of create you own lp script file. i.e:

#vi mylp

#$1: main queue
#$2: second queue
#$3: file
#Define any lp options.i.e:
#OPTIONS="-onb -oc -olandscape"
OPTIONS=""
if [ $# -ne 3 ]
then
echo "Usage: $0 "
exit 99
fi
if [ ! -d /var/spool/lp/request/$1 ]
the
echo "Error: $1 is not a valid queue"
exit 98
fi
if [ ! -d /var/spool/lp/request/$2 ]
the
echo "Error: $2 is not a valid queue"
exit 98
fi
if [ ! -f $3 ]
the
echo "Error: $1 file not found"
exit 98
fi

lp -d$1 $OPTIONS $3
lp -d$2 $OPTIONS $3

Rgds.