<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org">
    <title>Moving Jobs From Queue to Queue and Redirecting
    Queues</title>
    <meta name="GENERATOR" content=
    "Modular DocBook HTML Stylesheet Version 1.7">
    <link rel="HOME" title=" LPRng Reference Manual" href=
    "index.htm">
    <link rel="UP" title="Print Spooling Tutorial " href=
    "tutorial.htm">
    <link rel="PREVIOUS" title=
    "Printing from lpr Directly To A Device" href="x3378.htm">
    <link rel="NEXT" title=
    "Print Job Classes, User Requested Job Priority, and Form Support"
     href="x3472.htm">
  </head>

  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
  "#0000FF" vlink="#840084" alink="#0000FF">
    <div class="NAVHEADER">
      <table summary="Header navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <th colspan="3" align="center">LPRng Reference Manual: 24
          Sep 2004 (For LPRng-3.8.28)</th>
        </tr>

        <tr>
          <td width="10%" align="left" valign="bottom"><a href=
          "x3378.htm" accesskey="P">Prev</a></td>

          <td width="80%" align="center" valign="bottom">Chapter 4.
          Print Spooling Tutorial</td>

          <td width="10%" align="right" valign="bottom"><a href=
          "x3472.htm" accesskey="N">Next</a></td>
        </tr>
      </table>
      <hr align="LEFT" width="100%">
    </div>

    <div class="SECT1">
      <h1 class="SECT1"><a name="AEN3425">4.14. Moving Jobs From
      Queue to Queue and Redirecting Queues</a></h1>

      <p>The <tt class="COMMAND">lpc move</tt> command is used to
      move jobs in one queue to another queue on an individual
      basis, while the <tt class="COMMAND">lpc redirect</tt>
      command redirects all incoming jobs to a new queue. Edit the
      printcap file so it has contents indicated below, use <tt
      class="COMMAND">checkpc -f</tt> to check the printcap, and
      then use <tt class="COMMAND">lpc reread</tt> to restart the
      <b class="APPLICATION">lpd</b> server.</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN3433"></a>
<pre class="SCREEN">
    lp:force_localhost
    lp:server
      :sd=/var/spool/lpd/%P
      :lp=lp2@localhost
    lp2:force_localhost
    lp2:server
      :sd=/var/spool/lpd/%P
      :lp=/tmp/lp2
</pre>
      </div>
      Execute the following commands to print the <tt class=
      "FILENAME">/tmp/hi</tt> file and observe the results: 

      <div class="INFORMALEXAMPLE">
        <a name="AEN3436"></a>
<pre class="SCREEN">
    <samp class="PROMPT">h4: {238} %</samp> <kbd class=
"USERINPUT">lpc stop lp lp2</kbd>
    Printer: lp@h4
    lp@h4.private: stopped
    Printer: lp2@h4
    lp2@h4.private: stopped
    <samp class="PROMPT">h4: {239} %</samp> <kbd class=
"USERINPUT">lpr /tmp/hi</kbd>
    <samp class="PROMPT">h4: {240} %</samp> <kbd class=
"USERINPUT">lpq -a</kbd>
    Printer: lp@h4  (printing disabled)
     Queue: 1 printable job
     Server: no server active
     Rank   Owner/ID           Class Job Files      Size Time
    1      papowell@h4+659       A   659 /tmp/hi       3 08:04:03
    Printer: lp2@h4  (printing disabled)
     Queue: no printable jobs in queue
    <samp class="PROMPT">h4: {241} %</samp> <kbd class=
"USERINPUT">lpc move lp papowell lp2</kbd>
    Printer: lp@h4
    lp: selected 'papowell@h4+659'
    lp@h4.private: move done
    <samp class="PROMPT">h4: {242} %</samp> <kbd class=
"USERINPUT">lpq -a</kbd>
    Printer: lp@h4  (printing disabled)
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+659' removed at 08:19:24.962
    Printer: lp2@h4  (printing disabled)
     Queue: 1 printable job
     Server: no server active
     Rank   Owner/ID           Class Job Files       Size Time
    1      papowell@h4+659       A   659 /tmp/hi        3 08:19:24
</pre>
      </div>
      <br>
      <br>

      <p>We first stop the queues so that the jobs will remain in
      them. We then use the <tt class="COMMAND">lpc move fromqueue
      id toqueue</tt> command to select a job in the <span class=
      "emphasis"><i class="EMPHASIS">fromqueue</i></span> and move
      it to the <span class="emphasis"><i class=
      "EMPHASIS">toqueue</i></span>. A list of job numbers, job
      IDs, or glob patterns to match job IDs can be used to select
      the job.</p>

      <p>The <tt class="COMMAND">lpc redirect fromqueue
      toqueue</tt> will cause all incoming jobs to be redirected to
      the specified queue. You can execute the following commands
      and observe the results.</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN3454"></a>
<pre class="SCREEN">
    <samp class="PROMPT">h4: {243} %</samp> <kbd class=
"USERINPUT">lpc redirect lp lp2</kbd>
    Printer: lp@h4
    forwarding to 'lp2'
    lp@h4.private: redirected
    <samp class="PROMPT">h4: {244} %</samp> <kbd class=
"USERINPUT">lpq -a</kbd>
    Printer: lp@h4  (printing disabled) (redirect lp2)
     Queue: no printable jobs in queue
    Printer: lp2@h4  (printing disabled)
     Queue: no printable jobs in queue
    <samp class="PROMPT">h4: {245} %</samp> <kbd class=
"USERINPUT">lpr /tmp/hi</kbd>
    <samp class="PROMPT">h4: {246} %</samp> <kbd class=
"USERINPUT">lpq -a</kbd>
    Printer: lp@h4  (printing disabled) (redirect lp2)
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+935' removed at 09:08:21.410
    Printer: lp2@h4  (printing disabled)
     Queue: 1 printable job
     Server: no server active
     Rank   Owner/ID           Class Job Files        Size Time
    1      papowell@h4+935       A   935 /tmp/hi         3 09:08:21
</pre>
      </div>
      <br>
      <br>

      <p>To turn redirection off, use <tt class="COMMAND">lpc
      redirect queue off</tt> as shown in the example below:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN3466"></a>
<pre class="SCREEN">
    <samp class="PROMPT">h4: {247} %</samp> <kbd class=
"USERINPUT">lpc redirect lp off</kbd>
    Printer: lp@h4
    forwarding off
    <samp class="PROMPT">h4: {248} %</samp> <kbd class=
"USERINPUT">lpq</kbd>
    Printer: lp@h4  (printing disabled)
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+935' removed at 09:08:21.410
</pre>
      </div>
      <br>
      <br>
    </div>

    <div class="NAVFOOTER">
      <hr align="LEFT" width="100%">

      <table summary="Footer navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="33%" align="left" valign="top"><a href=
          "x3378.htm" accesskey="P">Prev</a></td>

          <td width="34%" align="center" valign="top"><a href=
          "index.htm" accesskey="H">Home</a></td>

          <td width="33%" align="right" valign="top"><a href=
          "x3472.htm" accesskey="N">Next</a></td>
        </tr>

        <tr>
          <td width="33%" align="left" valign="top">Printing from
          <b class="APPLICATION">lpr</b> Directly To A Device</td>

          <td width="34%" align="center" valign="top"><a href=
          "tutorial.htm" accesskey="U">Up</a></td>

          <td width="33%" align="right" valign="top">Print Job
          Classes, User Requested Job Priority, and Form
          Support</td>
        </tr>
      </table>
    </div>
  </body>
</html>



syntax highlighted by Code2HTML, v. 0.9.1