[net.unix] 4.2 Printer Spooler Question

saltiel@cdstar.UUCP (Jack Saltiel) (08/22/85)

We would like to hook up a HP laser jet printer to the spooler in
a special way. I would like to create two queues, by two different
names, with different spool directories and different output
filters. All this works fine, but if you enable printing on both
at once you get multiplexed output!! Is there anyway to set this
up, so that the device is shared properly and output files don't
get stepped on. Today we must stop printing on one queue to start
the other.
In case you're curious, we use one output filter for 66x127
landscape format output and another for 66x80 portrait format
output.
-- 
					Jack Saltiel
					Cambridge Digital Systems
					{wjh12,talcott}!cdstar!saltiel

	"Nailed retreads to my feet and prayer for better weather."

james@drutx.UUCP (DavisJB) (08/26/85)

< Eat at Joe's >


In-Reply-To: your article <136@cdstar.UUCP>

In reference to "cdstar!saltiel"'s question on mutilple spoolers
targeting one printer.  A rather simple solution to your problem
is a follows:

A while back I was working on an OA project on a small UNIXtm system.
The software for the OA included a whole gob of integrated packages
that also included its own spooling system.  The main vertical package
though, interfaced with the good ole UNIX spooling system.  At the
time I had the very same problem you are now.  I had new Diablo 80if
and laser printers everywhere printing everything mutlilplexed.

To solve this, I worked out a method of using a common "printer busy"
lock file.  In each of the different spooling filters, I added code
to check for the existance of the lockfile matched to the printer it
wanted.  Note that when a filter is executed, it needs to check if
the lock file is there, if not, create it and print away.  After it
is done printing (spooling) you need to wait a alittle before releasing
the lockfile.  This depends on the printers you use.  The Diablo took
a little time to reset after done printing so I waited about 10 seconds
before releasing the lock.  This cured the problem I had before when
a filter program was done, and another one grabed the lockfile, the
printer was still reseting (settling down) when the second filter
began output.  The result was anything but sane.

You might also want to put a pause in your filter after it grabs the
lockfile to give the printer alittle time to adjust to any new setup
commands.

You are on your own from here!


                                                        ___ 
                                                      =======
                                      ~             ===========
                                     ~             =-----=======
                              ~                   =-------======= 
                             __      _   _!__     =-------======= 
                        _   /  \_  _/ \  |::| ___ ==-----========   ~
                      _/ \_/^    \/   ^\/|::| |:|  ==========/^\_
  James B. Davis   /\/  ^ /  ^    / ^ ___|::|_|:|__|:|=====/  ^  \
                  /  \  _/ ^ ^   /    |::|--|:|---||:|==/  ^     ^\___
                _/_^  \/  AT&T Information Systems Denver Laboratory  \_
               /   \^ /   Computation  and Telecommunications Center    \
-------------------------------------------------------------------------
AT&T Information Systems
11900 N. Pecos St., DR31-Y31
Denver Colorado
(303) 538-1647
{ihnp4, mtuxo}!drutx!james
Disclaimer: I refuse to admit that I typed this.

rogers@athena.UUCP (Roger Southwick) (08/26/85)

[Do not meddle in the affairs of Unix, for it is subtle and quick to anger.]

> We would like to hook up a HP laser jet printer to the spooler in
> a special way. I would like to create two queues, by two different
> names, with different spool directories and different output
> filters. All this works fine, but if you enable printing on both
> at once you get multiplexed output!! Is there anyway to set this
> up, so that the device is shared properly and output files don't
> get stepped on. Today we must stop printing on one queue to start
> the other.

Hello there... I'll hope that you don't get hoards of these sorts of
answers. 

To start, I'll assume that you are using the same 'lp=/dev/foo' in
both entries in your /etc/printcap.  The problem is that setting up
a new queue says that there are multiple lock files for the device,
and the spooler assumes that if you send something to queue A, then
something to queue B, that both device A & B are open (not locked).

To solve this, use a line like:

	:lo=../QUEUENAME/lock: 

on all but one of your entries.  Thats how I fixed it.  For example
here is a portion of our /etc/printcap where I have set up 3 queues
and 3 filters for one device:


lprw|lp|Wide Line Printer:\
	:lp=/dev/lprw:\
	:sd=/usr/spool/lpd/lpwide:\
	:lf=/usr/spool/lpd/ERRORLOG:\
	:af=/usr/adm/lpdacct:\
	:if=/usr/lib/local/filters/printronix:\
	:gf=/usr/lib/gpf:\
	:of=/usr/lib/lpf:\
	:tr=\n\f:\
	:pq=lpwide:\
	:br#9600:
lpsloww|lps|Slow Wide Line Printer:\
	:lp=/dev/lprw:\
	:sd=/usr/spool/lpd/lpsw:\
	:lo=../lpwide/lock:\
	:lf=/usr/spool/lpd/ERRORLOG:\
	:af=/usr/adm/lpdacct:\
	:if=/usr/lib/local/filters/printronix:\
	:gf=/usr/lib/gpf:\
	:of=/usr/lib/local/filters/lpf_slow:\
	:tr=\n\f:\
	:pq=lpsw:\
	:br#9600:
lafastw|lpf|Fast Wide Line Printer:\
	:lp=/dev/lprw:\
	:sd=/usr/spool/lpd/lpfw:\
	:lo=../lpwide/lock:\
	:lf=/usr/spool/lpd/ERRORLOG:\
	:af=/usr/adm/lpdacct:\
	:if=/usr/lib/local/filters/printronix:\
	:gf=/usr/lib/gpf:\
	:of=/usr/lib/local/filters/lpf_fast:\
	:tr=\n\f:\
	:pq=lpfw:\
	:br#9600:

Hope that solves your problem.

	-Roger

saltiel@cdstar.UUCP (Jack Saltiel) (08/28/85)

In article <289@drutx.UUCP>, james@drutx.UUCP (DavisJB) writes:
> In-Reply-To: your article <136@cdstar.UUCP>
> 
> In reference to "cdstar!saltiel"'s question on mutilple spoolers
> targeting one printer.  A rather simple solution to your problem
> is a follows:
> 
> To solve this, I worked out a method of using a common "printer busy"
> lock file.  

In fact, this is what we implemented yesterday. Fortunatly the HP
laserjet printer does not have any time dependent problems.
Everything that comes the serial line is handled serially.

A filter that wants the printer checks for the existence of a lock
every N seconds, until it does not appear. When a filter is
finished, it unlinks the lock file and waits 2N seconds before
it goes away. In this manner, stuff is taken from alternate
queues.

This solution works reliably (based on two days experience.)

If anybody want the source to these filters, fire me a letter
and I'll send them off to you.

			Tanks again!

-- 
					Jack Saltiel
					Cambridge Digital Systems
					{wjh12,talcott}!cdstar!saltiel

	"Nailed retreads to my feet and prayed for better weather."

chris@umcp-cs.UUCP (Chris Torek) (08/28/85)

(Not an answer, but a plug for MDQS:)  We run BRL's MDQS (with some
local hacks) and it handles multiple queues on one printer, or
multiple printers on one queue, just fine.  It also has network
servers, so that all machines can print on any machine's printer.

Here's a sample from /etc/qconf (the config file).  I've broken down
a couple of long lines, and added comments here & there.

#
#  Device Descriptions
#
# "imagen" and "cthulhu" are the two Imagen 8/300s; both are on
# the Ethernet.  Whichever one is available gets used.
imagen	/dev/null	skipmsg,anyform 
cthulhu	/dev/null	skipmsg,anyform
# these are pseudo-devices for translating troff and TeX output
# to imPress before sending to the Imagen; by putting them in
# queues we single-thread this stuff and keep the load down.
catdvi	/dev/null	skipmsg,anyform
texdvi	/dev/null	skipmsg,anyform
-----------------------------------
#
#  Queue Descriptions
#
imagen-imp  	
imagen-cat
imagen-texdvi
-----------------------------------
#
#  Queue-->Device Mappings
#
# imagen-cat converts C/A/T stuff to impress stuff, and requeues it:
imagen-cat	catdvi	/usr/lib/mdqs/procserver -s /ful/imagen/bin/catdvi |
			/usr/bin/qpr -q imagen-imp -t $T -u $U
# imagen-texdvi converts a .dvi file to Impress, and requeues it:
imagen-texdvi	texdvi	/usr/lib/mdqs/procserver -s /usr/local/bin/imagen1 -s |
			/usr/bin/qpr -q imagen-imp -t $T -u $U
# imagen-imp is served by TWO devices (the two printers), so that
# they are both used in parallel.  "Bandersnatch" is the name of
# the first 8/300, "cthulhu" is the name of the second.
imagen-imp	imagen	/usr/lib/mdqs/rimeserver impress /usr/adm/imagenacct
			bandersnatch
imagen-imp	cthulhu	/usr/lib/mdqs/rimeserver impress /usr/adm/imagenacct
			cthulhu
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland