Sponsored Content
Full Discussion: Catching print jobs.
Top Forums UNIX for Dummies Questions & Answers Catching print jobs. Post 302228208 by Danny.Chouinard on Saturday 23rd of August 2008 01:00:39 PM
Old 08-23-2008
"UNIX" can mean a lot of things.

Ok, here's what you can do, replace lpr with a script.

First, find out where it lives. Let's say for example it's /usr/bin/lpr.

Then replace with a script that logs how it's called and tries to copy the printer output to a file.

Code:
$ su
Password:
# mv /usr/bin/lpr /usr/bin/real.lpr
cat > /usr/bin/lpr
#!/bin/sh
exec >/tmp/lpr.debug 2>&1
set +xv
echo "Lpr called on `date` with these arguments:"
echo "0:$0 1:$1 2:$2 3:$3 4:$4 5:$5 6:$6 7:$7 8:$8 9:$9"
filenames=""
args=""
while [ $# -gt 0 ]; do
  case $1 in
    -* ) args="$args $1" ;;
    * ) filenames="$filenames $1" ;;
  esac
  shift
done
if [ "$filenames" = "" ]; then
  filenames=/tmp/lpr.stdin
  cat > /tmp/lpr.stdin
fi
cat /dev/null > /tmp/lpr.output
for f in $filenames; do
  cat $f >> /tmp/lpr.output
done
exec /usr/bin/real.lpr $* < /tmp/lpr.output
exit 0
^D
# chmod 755 /usr/bin/lpr

That should get you started. Check /tmp/lpr.debug to see what's happening.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting a batch of print jobs

Hi Guys I have over 2000+ print jobs in one queue which I would like to delete. Is there away in AIX 4.3 that I can delete the whole print jobs at ocne. Instead of one at a time. Thanks (1 Reply)
Discussion started by: orvelb
1 Replies

2. SCO

Random duplicated print jobs

I have a weird problem, about 6 times a day a print job will be printed twice (out of more than 100 print jobs per day). It seems as though sometimes a print job is not cleared from the print spooler after the first print, and then reprints. This started a week ago after I had made printer... (1 Reply)
Discussion started by: Barry Staples
1 Replies

3. SCO

Print jobs getting stuck on the queue

I have implemented Laser printers using USB printer servers connected to a SCO server. Sometimes print jobs get stuck on the queue and I havent found a way of getting the printer back to work without canceling the jobs and rebooting the system. Why jobs get stuck? How do I get this solved... (9 Replies)
Discussion started by: iNetForce
9 Replies

4. HP-UX

Print Queue jobs stuck

Hello, I have a print queue that the jobs are getting stuck in. I've disabled and enabled the queue, lpshut and lpsched the print spooler, and killed a suspected corrupt job. But new requests still get stuck. I can ping the printer by DNS with no problem. What else can I look for? I'm a little... (3 Replies)
Discussion started by: mizzleman
3 Replies

5. Linux

holding print jobs in CUPS

Hi all. I have a problem with some printers that when I print a lot of jobs at once the printers gets stuck after 2 prints... (It's a barcode printers - DATAMAX). Whenever I'm printing each job separtly with a delay of a few seconds the printers work fine... So my question is how can I... (0 Replies)
Discussion started by: eliraza6
0 Replies

6. Shell Programming and Scripting

print queue jobs

Hi, I have one queue that have status QUEUE and 10 jobs are waiting.Can any one guide me how i can get total number of jobs on this queue.i can see 10 jobs but i need to get count 10 for this queue.Please help me out thanks in advance sagii (2 Replies)
Discussion started by: sagii
2 Replies

7. Shell Programming and Scripting

print queue jobs

Hi, i m having problem to get number of jobs waiting using lpstat.my printer is out of paper and 10jobs are in queue but i run lpstat -pqname it didnt show any thing.any one have idea whats wrong here. thanks sagii (2 Replies)
Discussion started by: sagii
2 Replies

8. Shell Programming and Scripting

print q jobs

Hi, I need to get queue name ,status and numbero jobs waiting in queue.I was using lpstat and i got the queue name ,status and number of jobs waiting but the problem with lpstat is that when printer is out of paper then it shows printer status ready and 0 jobs in queue.is there any way that i can... (4 Replies)
Discussion started by: sagii
4 Replies

9. UNIX for Advanced & Expert Users

[Solved] remove all print jobs from a print queue

Hello, Sometimes i need to clear all the jobs of a print queue and it is really annoying to cancel one by one. Is there a way to cancel all print jobs for a specific print queue with a single command instead of cancelling them one by one? My AIX system is 5.3 Thank you for your attention (2 Replies)
Discussion started by: omonoiatis9
2 Replies

10. AIX

Print jobs stuck in queue

Hi, have an aix system with something I've never seen happening. All printers are not printing. I see jobs Queued and printer status as READY but jobs just keep getting queued and nothing's printing. Seems to be a system wide problem since it's affecting all printers. Help... (2 Replies)
Discussion started by: flash88
2 Replies
tplot(1)                                                           User Commands                                                          tplot(1)

NAME
tplot, t300, t300s, t4014, t450, tek, ver - graphics filters for various plotters SYNOPSIS
/usr/bin/tplot [-T terminal] DESCRIPTION
tplot reads plotting instructions from the standard input and produces plotting instructions suitable for a particular terminal on the standard output. If no terminal is specified, the environment variable TERM is used. The default terminal is tek. ENVIRONMENT VARIABLES
Except for ver, the following terminal-types can be used with `lpr -g' (see lpr) to produce plotted output: 300 DASI 300 or GSI terminal (Diablo(R) mechanism). 300s | 300S DASI 300s terminal (Diablo mechanism). 450 DASI Hyterm 450 terminal (Diablo mechanism). 4014 | tek Tektronix 4014 and 4015 storage scope with Enhanced Graphics Module. (Use 4013 for Tektronix 4014 or 4015 without the Enhanced Graphics Module). ver Versatec(R) D1200A printer-plotter. The output is scan-converted and suitable input to `lpr -v'. FILES
/usr/lib/t300 /usr/lib/t300s /usr/lib/t4014 /usr/lib/t450 /usr/lib/tek /usr/lib/vplot ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
lp(1), vi(1), attributes(5) SunOS 5.10 14 Jul 1994 tplot(1)
All times are GMT -4. The time now is 08:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy