SUMMARY: [#2] Print to 2 queues at once

Shaun.Racine_at_intier.com
Date: 08/01/03

  • Next message: Malek Shabou: "SUMMARY: fix root_domain when using LSM"
    Date: Fri, 01 Aug 2003 14:42:28 +0000
    To: tru64-unix-managers@ornl.gov
    
    

    Sorry for another summary, got 2 more responses, of which I tested and
    chose Alan Davis' reply.

    Thanks to;
    Alan Davis
    Fred N. van Kempen
    Lawrie Smith

    Original Question:

    ES40, Tru64 v5.1A, patch kit 1.
    HP Laserjet 4100 with internal Jetdirect card.

    Our application prints to a printer via LPD, which we suspect of giving us
    a problem.

    Is there a way to set up a print queue in Unix so that it prints to 2
    printers from one print queue? We want to compare the output from both.

    More info: When we configure our printers and queues, we edit the printcap
    file directly and manually create spool directories and so on. We do not
    use lprsetup or other helpful utility.

    Here is the section in printcap;
    mm_hp4|lp35|mm_hp4:\
            :lp=:\
            :rm=MM_HP4:\
            :rp=text:\
            :lf=/usr/spool/lpd/mm_hp4.log:\
            :sd=/usr/spool/lpd/mm_hp4:

    Reply from Alan Davis (btw: tested and working);

    Here's how I do it (stripped down - add appropriate error checking,
    etc.)...

    Set up the print queue that the application uses with an 'if' entry that
    does this :

    applpr|Application print queue:\
            :if=/usr/local/bin/splitlpr:\
            :sd=/usr/spool/testlp:\
            :lf=/usr/adm/lperr:\
            :lp=/dev/null:

    ---------- cut here for shell script
    #!/bin/ksh
    # /usr/local/bin/splitlpr

    /bin/cat > /tmp/splitlpr.$$

    /bin/lpr -Prealprinter /tmp/splitlpr.$$
    /bin/lpr -Pdiagqueue /tmp/splitlpr.$$

    /bin/rm /tmp/splitlpr.$$
    exit
    ------------ end shell script

    Keep in mind that you can also stop the queue from printing but still allow
    it to queue. This allows you to examine the files in the queue before
    printing to validate the file.

    Reply from Fred N. van Kempen;

    Actually, there is a way. It requires some (simple) programming, but
    can be done.

    Basically, at the Printcap level, define your two printers as needed,
    and verify they work when printing to them.

    Then, you need to define a 'duplex' printer, meaning, it takes one
    copy of input, and then writes multiple copies out to printers. This
    is usually done by writing a small C program which then runs in the
    background, for example:

    # /etc/duplexer /dev/lpduplx lp0 lp1 lp3

    would create a fake printer device "lpduplx" in /dev, and all input to
    it would be spooled to printers lp0, lp1 and lp3. Once this works (by
    doing a cp /etc/passwd /dev/lpduplx and seeing it come out of the three
    printers) you can define "your" printer in Printcap with the lp: option
    set to be lp=/dev/lpduplx ...

    I can write something like this tonight if you need it fast.

    Reply from Lawrie Smith;

    I would set up a wrapper script to take the same command line arguments as
    lpr
    And call the script, something like

    #! /usr/bin/ksh
    ##########################################################################
    # A quick and dirty wrapper for printing
    #
    # No parameter checking occurs in this version.
    # Only errors are logged as the lpd will log successful printing
    #
    # Lawrie Smith - (WM) Technical services - December 2001
    ##########################################################################

    USAGE="usage: $0 orientation printer document"
    # The script takes three parameters

    if (($# == 0))
    then
            print ""
            print "You must specify between 2 or 3 command line arguments"
            print ""
            print "If two arguments are given they are assumed to be"
            print "printer and document (including full path)"
            print ""
            print "If three arguments are given they are assumed to be"
            print "orientation printer and document (including full path)"
            print ""
            print "EXAMPLE: JupiterP portrait shfcomp3
    /app/application/document"
            print "NB: No parameter checking is performed"
            print ""
            print "$USAGE"
    else
            case $# in
                    2) cat $2 | tr '#' '£' | lpr -P$1
                    ;;
                    3) cat $3 | tr '#' '£' | lpr -O$1 -P$2
                    ;;
                    *) ERROR="$LOGNAME: Incorrect number of parameters `date`"
                       print $ERROR >> JupiterP.err
                    ;;
            esac
    fi


  • Next message: Malek Shabou: "SUMMARY: fix root_domain when using LSM"

    Relevant Pages

    • RE: Printing pre-setup (was: Is VMS losing the Financial Sector, also?)
      ... and had no trouble pointing it to a LPD queue that is ... servers or printers with network cards. ... First you create a device control text library, ... Then you create a print queue to that printer and associate the device ...
      (comp.os.vms)
    • shared queue and direct printing via TCPIP DECservers
      ... printing to those same lasers, and direct printing to several dot ... matrix printers, is losing their MUXserver network, and therefore LAT. ... with the MUX server and port, queue aimed at the LTA device, LTA device ...
      (comp.os.vms)
    • Re: [opensuse] Printing Failure
      ... couple of days I have not been able to get any of my 5 usb printers to ... Sending a file to a print queue from any app show up in KDE's ... are displayed during either the setup test or normal printing. ... check the syntax of lppasswd with "man lppasswd" before you go ahead, ...
      (SuSE)
    • Re: [opensuse] Printing Failure
      ... couple of days I have not been able to get any of my 5 usb printers to ... Sending a file to a print queue from any app show up in KDE's ... are displayed during either the setup test or normal printing. ... check the syntax of lppasswd with "man lppasswd" before you go ahead, ...
      (SuSE)
    • Re: Windows server 2003 printing problem - dialog box on console must be clicked to resume priti
      ... There are around 50 network printers that are connected to ... queues on this server. ... problem print queue. ... open each print queue to see which one is having a problem. ...
      (microsoft.public.windows.server.general)