4.16. Holding and Releasing Jobs

The LPRng software has a wide range of facilities to hold or temporarily prevent jobs from printing. Jobs can be individually held or all jobs submitted to a queue can be held until released by an operator. Some administrators use the holdall facility and a cron script to cause jobs to be printed at specific times. The lpc holdall command causes all jobs submitted to a queue to be held until released with the lpc release command. The lpc noholdall command disables the holdall operation.

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: {256} % lpc holdall lp
    Printer: lp@h4
    lp@h4.private: holdall on
    h4: {257} % lpq
    Printer: lp@h4  (holdall)
     Queue: no printable jobs in queue
    h4: {258} % lpr /tmp/hi
    h4: {259} % lpq
    Printer: lp@h4  (holdall)
     Queue: no printable jobs in queue
     Holding: 1 held jobs in queue
     Server: no server active
     Rank   Owner/ID           Class Job Files        Size Time
    hold   papowell@h4+213       A   213 /tmp/hi         3 09:45:05
    h4: {260} % lpc release lp 213
    Printer: lp@h4
    lp: selected 'papowell@h4+213'
    lp@h4.private: started
    h4: {261} % lpq
    Printer: lp@h4  (holdall)
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+213' removed at 09:45:22.570


The lpc holdall command causes all jobs to be held. We spool a job, and then use the lpc release command to release the selected job. We disable the holdall operation using the lpc noholdall command.

    h4: {262} % lpc noholdall lp
    Printer: lp@h4
    lp@h4.private: holdall off


You can also use the lpc hold command to select individual jobs in a spool queue to be held. This command is useful if there is a set of jobs which require special handling or printing at a later date. The following example shows how this command is used. We use the lpc stop and lpc start commands to simulate the normal delays in print spooling operations.

    h4: {263} % lpc stop lp
    Printer: lp@h4
    lp@h4.private: stopped
    h4: {264} % lpq
    Printer: lp@h4  (printing disabled)
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+495' removed at 10:10:50.629
    h4: {265} % lpr /tmp/hi
    h4: {266} % lpr /tmp/hi
    h4: {267} % lpq
    Printer: lp@h4  (printing disabled)
     Queue: 2 printable jobs
     Server: no server active
     Rank   Owner/ID           Class Job Files        Size Time
    1      papowell@h4+459       A   459 /tmp/hi         3 10:40:32
    2      papowell@h4+461       A   461 /tmp/hi         3 10:40:34
    h4: {268} % lpc hold lp 459
    Printer: lp@h4
    lp: selected 'papowell@h4+459'
    lp@h4.private: updated
    h4: {269} % lpq
    Printer: lp@h4  (printing disabled)
     Queue: 1 printable job
     Holding: 1 held jobs in queue
     Server: no server active
     Rank   Owner/ID           Class Job Files        Size Time
    1      papowell@h4+461       A   461 /tmp/hi         3 10:40:34
    hold   papowell@h4+459       A   459 /tmp/hi         3 10:40:32


In the next example we show how to use the lpc hold command to select and hold an individual job. Then we start the queue and see what happens:

    h4: {270} % lpc start
    Printer: lp@h4
    lp@h4.private: started
    h4: {271} % lpq
    Printer: lp@h4
     Queue: no printable jobs in queue
     Holding: 1 held jobs in queue
     Server: no server active
     Status: job 'papowell@h4+461' removed at 10:41:24.873
     Rank   Owner/ID           Class Job Files        Size Time
    hold   papowell@h4+459       A   459 /tmp/hi         3 10:40:32
    h4: {272} % lpc release lp 459
    Printer: lp@h4
    lp: selected 'papowell@h4+459'
    lp@h4.private: started
    h4: {273} % lpq
    Printer: lp@h4
     Queue: no printable jobs in queue
     Status: job 'papowell@h4+459' removed at 10:41:39.457


As we see, the held job is not printed until we release it, and then is processed normally.

The printcap :ah (autohold) option has the same effect as the lpc holdall command but its actions cannot be disabled by the lpc noholdall command.