Yesterday Jeff Chua of FexEx (Federal Express) <[EMAIL PROTECTED]>
showed up at my office armed with a set of test scripts and a laptop
running LPRng.  He demonstrated the problem of the 'missing datafile'
during job transfers.  I have fixed the problem in this release.

The test is so clever that I thought I would share it and put it into the
changes file for posterity.

The first step was to set up a print queue:

lp:
  :sd=/tmp/lpd/%P
  :filter=/tmp/testfilter
  :lp=/dev/null

The /tmp/testfilter is:
#!/bin/sh
if [ ! -d /tmp/files ] ; then mkdir /tmp/files ; fi
# read the first line of the job and create a file with the name
read var
date >/tmp/files/$var

Now here is the script we use to test the queue:

#!/usr/local/bin/bash
# /tmp/testpr
set -x
lprm -Plp all
d=/tmp/files
if [ ! -d $d ] ; then mkdir -p $d; fi
chmod 777 /tmp/files
(cd /tmp/files; rm -f *; )

Here is a script to submit the jobs:

#/bin/bash
# print a job with a number as the contents 
for((i=${2:-0}; i < ${1:-10}; ++i)) ; do echo $i |lpr -Pp; done;

Lets run this with printing disabled:

> lpc -P stop
> bash /tmp/testpr 999

+ lprm -Plp all
Printer lp@h110:
+ d=/tmp/files
+ '[' '!' -d /tmp/files ']'
+ cd /tmp/files
+ rm -f '*'
+ (( i=0 ))
+ (( i < 999 ))
+ echo 0
+ lpr -Pp
+ (( ++i ))
+ (( i < 999 ))
+ echo 1
+ lpr -Pp
+ (( ++i ))
+ (( i < 999 ))
+ echo 2
+ lpr -Pp
+ (( ++i ))
+ (( i < 999 ))
+ echo 3

And we get:

> lpq
Printer: lp@h110 (printing disabled)
 Queue: 999 printable jobs
 Server: no server active
 Rank   Owner/ID                  Class Job Files                 Size Time
1      papowell@h110+384            A   384 (STDIN)                  2 08:40:56
2      papowell@h110+387            A   387 (STDIN)                  2 08:40:56
3      papowell@h110+390            A   390 (STDIN)                  2 08:40:56
4      papowell@h110+393            A   393 (STDIN)                  2 08:40:56
...


Now if you enable printing (lpc start) then you can get the jobs in the
output queue.

This is DEFINATELY clever.

We can use this for testing spooling rates, throughput, etc. etc. etc.

Here is how to bring the system to its knees:

        bash /tmp/testpr 200 0 &
        bash /tmp/testpr 400 200 &
        bash /tmp/testpr 600 400 &
        bash /tmp/testpr 800 600 &
        bash /tmp/testpr 1000 800 &

You can modify this a bit so that you put:

#/bin/bash
# print a job with a number as the contents 
hostname=`hostname`
for((i=${2:-0}; i < ${1:-10}; ++i)) ; do echo ${hosname}.${i} |lpr -Pp -J 
"${hostname}.${i}"; done;


Patrick ("very very clever") Powell

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to