From: Carl Carraway <carrawayc () midlandstech ! com>
To: tru64-unix-managers
Subject: How to send printer output to a file instead of a printer
Date: Fri, 29 Jun 2001 17:54:13 +0000 [thread overview]
Message-ID: <102653649622161.tru64-unix-managers.marc@archive.invalid> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="------_=_NextPart_001_01C100C4.81E73D90", Size: 10312 bytes --]
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C100C4.81E73D90
Content-Type: text/plain;
charset="iso-8859-1"
I need to route output from a printer queue to file instead of to a printer.
This needs to function like a "dummy" print queue where the user can
use the lpr command as if they were actually going to print the file, but
the file needs to land in a hold directory where another application
will grab the file and perform special processing that lpd/printcap cannot
perform to produce the output and ultimately send it to a network printer.
In /etc/printcap I have defined the following queue, called "testq".
testq:\
:lp=/dev/null:\
:of=/usr/lbin/testq.of:\
:sd=/usr/users/spool/testq
:lf=/usr/adm/testqerr:
The output filter (/usr/lbin/testq.of) contains:
#! /bin/csh -f
#
# Output filter for testq
#
# Test first to see if the print job can be copied to test.fil
#
/bin/cat > /usr/users/hold/testq/test.fil
When I enter "lpr -P testq filename" the system queues the job into
the testq queue, where it just sits. The control and data files sit in
the spool directory /usr/users/spool/testq and no file appears in the
desired final hold directory of /usr/users/hold/testq. The lf file is
also blank after executing the lpr command.
Also, in my output filter I attempted to copy the file to a file called
/usr/users/hold/testq/test.fil. Is there a way the filename used in the
lpr command can be passed and used to keep the file the same name
when it is routed to the hold directory? If not I could use a timestamp
in the output filter to assign a unique file name.
Thanks in advance!
Carl Carraway carrawayc@midlandstech.com
Computer Systems Manager 803-738-7624
Midlands Technical College
Columbia, SC
------_=_NextPart_001_01C100C4.81E73D90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>Tape drive.</TITLE>
<META content=3D"MSHTML 5.00.3314.2100" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>I =
need to route=20
output from a printer queue to file instead of to a =
printer.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>This =
needs to=20
function like a "dummy" print queue where the user =
can</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>use =
the lpr command=20
as if they were actually going to print the file, =
but</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>the =
file needs=20
to land in a hold directory where another =
application</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>will =
grab the file=20
and perform special processing that lpd/printcap =
cannot</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D159342417-29062001>perform to produce=20
the output</SPAN></FONT><FONT face=3DArial size=3D2><SPAN =
class=3D159342417-29062001>=20
and ultimately send it to a network printer.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>In =
/etc/printcap I=20
have defined the following queue, called "testq".</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001>testq:\ &n=
bsp; &n=
bsp; &n=
bsp; &n=
bsp; &n=
bsp; &n=
bsp; =20
<BR> =20
:lp=3D/dev/null:\ &=
nbsp; &=
nbsp; &=
nbsp; &=
nbsp; &=
nbsp; =20
<BR> =20
:of=3D/usr/lbin/testq.of:\ &nbs=
p; &nbs=
p; &nbs=
p; &nbs=
p; =20
<BR> =20
:sd=3D/usr/users/spool/testq &n=
bsp; &n=
bsp; &n=
bsp; <BR> =20
:lf=3D/usr/adm/testqerr: </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>The =
output filter=20
(/usr/lbin/testq.of) contains:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>#! =
/bin/csh=20
-f &nbs=
p; &nbs=
p; &nbs=
p; &nbs=
p; &nbs=
p; =20
<BR># &=
nbsp; &=
nbsp; &=
nbsp; &=
nbsp; &=
nbsp; &=
nbsp; =20
<BR># Output filter for testq</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001>#</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D159342417-29062001># Test first to=20
see if the print job can be copied to test.fil</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001># &n=
bsp; &n=
bsp; &n=
bsp; &n=
bsp; =20
<BR>/bin/cat > /usr/users/hold/testq/test.fil</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>When =
I enter "lpr -P=20
testq filename" the system queues the job =
into</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>the =
testq queue,=20
where it just sits. The control and data files sit =
in</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>the =
spool directory=20
/usr/users/spool/testq and no file appears in =
the</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D159342417-29062001>desired final hold=20
directory of /usr/users/hold/testq. The =
lf file=20
is</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>also =
blank after=20
executing the lpr command.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>Also, =
in my output=20
filter I attempted to copy the file to a file called =
</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001>/usr/users/hold/testq/test.fil. =
Is there a=20
way the filename used in the</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>lpr =
command can be=20
passed and used to keep the file the same name</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>when =
it is routed to=20
the hold directory? If not I could use a=20
timestamp</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D159342417-29062001>in =
the output filter=20
to assign a unique file name.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D159342417-29062001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D159342417-29062001>Thanks in=20
advance!</SPAN></FONT></DIV>
<P><FONT face=3DArial size=3D2>Carl=20
Carraway &nbs=
p; &nbs=
p; =20
carrawayc@midlandstech.com</FONT> <BR><FONT face=3DArial =
size=3D2>Computer Systems=20
Manager 803-738-7624</FONT> <BR><FONT =
size=3D2><FONT=20
face=3DArial>Midlands Technical College</FONT></FONT><FONT =
size=3D2><FONT=20
face=3DArial><SPAN class=3D159342417-29062001><BR>Columbia,=20
SC </SPAN></FONT></FONT></P></BODY></HTML>
------_=_NextPart_001_01C100C4.81E73D90--
reply other threads:[~2001-06-29 17:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox