Printing to multiple spooled printers

Who is Participating?
artembConnect With a Mentor Commented:
One possible solution is to use FIFOs ("mknod file p"). Create named pipe named /dev/slpX, write a script (or a program, which will be better) that will read from the FIFO and pipe everything to lpr.
Something like that:


while true; do
   cat $DEV | $COMMAND "$@"
#--end of script

And then run it
./script /dev/slp0 lpr -pPRINTER0
./script /dev/slp1 lpr -pPRINTER1

The script is a draft just to illustrate the idea.

DarkNovaAuthor Commented:
If people are confused by this, basically what would be ideal is if I could create a device called /dev/slp0 or something and if I issue the command "cat testfile.txt > /dev/slp0" then it would issue the command "lpr -PPRINTER0 < testfile.txt", and it would have devices /dev/slp1 for PRINTER1 and /dev/slp2 for PRINTER2. Then the program would work. These device files have to be some sort of pipes or devices though, because I tried writing a chmod 755 shell script and the program just overwrote it with its output (if it doesn't see it as a device it thinks its supposed to dump the output to that filename). Does this help any or is it more confusing now? Please post a comment if you have any questions.
DarkNovaAuthor Commented:
Thanks. This works good. For anyone who's looking back at this response, note that the line that says:
should read:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.