![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print Queue jobs stuck | mizzleman | HP-UX | 3 | 07-02-2008 08:52 PM |
| Print jobs getting stuck on the queue | iNetForce | SCO | 9 | 04-20-2007 08:20 PM |
| Random duplicated print jobs | Barry Staples | SCO | 1 | 03-20-2007 05:34 PM |
| jobs stalled in remote print queue | antalexi | UNIX for Advanced & Expert Users | 0 | 08-03-2004 12:07 PM |
| Deleting a batch of print jobs | orvelb | UNIX for Dummies Questions & Answers | 1 | 02-09-2001 12:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Catching print jobs.
Hi,
I am wondering how to catch print jobs to process them before been served to the printer. I was told that the challenge is to catch raw text that an old legacy application sends to the printer (invoices, quotes, etc) and save them as text files to allow a new application to process them doing diferent new stuff that the old app can not. We need to try this approach because there are no people that can change the legacy app's code. The client is thinking on change the app but we need to offer a solution now. Does anybody konws how to do that? Thanks in advance. |
|
||||
|
"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
|
|
||||
|
Thanks Danny,
I know that saying UNIX is not enough, but is all I have. Your answer gives me the idea of how to handle this. This project is not approved yet, but thanks to you guys I have an idea of the different things that I should take in account. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| catch print job, lpr filter, print jobs, print spool, printing, unix catch printing jobs, unix print |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|