LPRng Reference Manual: 3 May 2004 (For LPRng-3.8.27)
Prev | Chapter 4. Print Spooling Tutorial | Next

# 4.14. Moving Jobs From Queue to Queue and Redirecting Queues

The `lpc move` command is used to move jobs in one queue to another queue on an individual basis, while the `lpc redirect` command redirects all incoming jobs to a new queue. Edit the printcap file so it has contents indicated below, use `checkpc -f` to check the printcap, and then use `lpc reread` to restart the lpd server.

        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

Execute the following commands to print the `/tmp/hi` file and observe the results:

        h4: {238} % lpc stop lp lp2
        Printer: lp@h4
        lp@h4.private: stopped
        Printer: lp2@h4
        lp2@h4.private: stopped
        h4: {239} % lpr /tmp/hi
        h4: {240} % lpq -a
        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
        h4: {241} % lpc move lp papowell lp2
        Printer: lp@h4
        lp: selected 'papowell@h4+659'
        lp@h4.private: move done
        h4: {242} % lpq -a
        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

We first stop the queues so that the jobs will remain in them. We then use the `lpc move fromqueue id toqueue` command to select a job in the fromqueue and move it to the toqueue. A list of job numbers, job IDs, or glob patterns to match job IDs can be used to select the job.

The `lpc redirect fromqueue toqueue` will cause all incoming jobs to be redirected to the specified queue. You can execute the following commands and observe the results.

        h4: {243} % lpc redirect lp lp2
        Printer: lp@h4
        forwarding to 'lp2'
        lp@h4.private: redirected
        h4: {244} % lpq -a
        Printer: lp@h4  (printing disabled) (redirect lp2)
         Queue: no printable jobs in queue
        Printer: lp2@h4  (printing disabled)
         Queue: no printable jobs in queue
        h4: {245} % lpr /tmp/hi
        h4: {246} % lpq -a
        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

To turn redirection off, use `lpc redirect queue off` as shown in the example below:

        h4: {247} % lpc redirect lp off
        Printer: lp@h4
        forwarding off
        h4: {248} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: no printable jobs in queue
         Status: job 'papowell@h4+935' removed at 09:08:21.410

Prev | Home | Next
Printing from lpr Directly To A Device | Up | Print Job Classes, User Requested Job Priority, and Form Support