Pulling something back from the unix spooler

Posted on 2003-02-20
Medium Priority
Last Modified: 2010-04-21

I'm hoping someone can help. I'm trying to write routine to retrive the text of a print job that has already been submitted to the lp subsystem for printing.

There is a 3rd party software program that we have no control over that sends its output (simple ASCII) to a particular queue, which has no printer physically attached. I'm looking for a way to retrieve that output. The directories and files of the lpd daemon (/var/spool/blah/blah/blah) are all owned by root (and I do not want this script to run as root), so I cannot simply copy the output with cp. I can, however, run it with the same userid as the spooling program.

Is there a way to "redirect" the output from a job awaiting printing? BTW, I'm running a recent version of DEC UNIX on this box.


Question by:jalosa
  • 2
  • 2

Accepted Solution

ellesd earned 1050 total points
ID: 7990104
Is all the output of the program sent to the spool?  If so, can you just redirect the output of the program?  If not, does it use lp to send the output, or does it do it on its own?  If so, you can write a wrapper for lp to detect the userid of the program and copy the file to wherever you want.  I'm sure there are other methods, but this is a start.  Let me know how the program is actually sending its output to the spool.

Expert Comment

ID: 7993706
It will be easy to check this 3rd party documens of how to configure it's output.
If no docs, then search for any env setting at it's script.

good Luck

Author Comment

ID: 7994389
Thanks for the replies, but the 3rd party installation is "hostile". I have no docs (don't even think they exist). Also a wrapper is not feasible for other reasons that I won't go into here (but good idea).

I need a command line or short script solution. I have no control over the job prior to it arriving in the queue. Is there no command to redirect the output for a job you own?

Expert Comment

ID: 7995597
that means you are not the owner of this job. so who support this application if something going bad.

Expert Comment

ID: 7996557
What exactly do you need to do with the print job? By "redirect", do you mean you are trying to send it to another printer or are you trying to make a copy of the actual file into another directory?  Try to give some more detail.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question