LPRng Reference Manual: 24 Sep 2004 (For LPRng-3.8.28)
Prev | Chapter 4. Print Spooling Tutorial | Next

# 4.8. Job Removal

Occasionally we print a file and then change our mind and want to cancel the job. The lprm command allows us to do this.

        h4: {154} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: 3 printable jobs
         Server: no server active
         Status: job 'papowell@h4+17922' removed at 18:15:13.981
         Rank   Owner/ID          Class Job Files      Size Time
        1      papowell@h4+17959    A 17959 (stdin)       3 18:23:24
        2      papowell@h4+17962    A 17962 (stdin)       6 18:23:30
        3      papowell@h4+17970    A 17970 (stdin)       5 18:23:35
        h4: {155} % lprm
        Printer lp@h4:
          checking perms 'papowell@h4+17959'
          dequeued 'papowell@h4+17959'
        h4: {156} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: 2 printable jobs
         Server: no server active
         Status: job 'papowell@h4+17922' removed at 18:15:13.981
         Rank   Owner/ID          Class Job Files      Size Time
        1      papowell@h4+17962    A 17962 (stdin)       6 18:23:30
        2      papowell@h4+17970    A 17970 (stdin)       5 18:23:35
        h4: {157} % lprm 17970
        Printer lp@h4:
          checking perms 'papowell@h4+17970'
          dequeued 'papowell@h4+17970'
        h4: {158} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: 1 printable job
         Server: no server active
         Status: job 'papowell@h4+17922' removed at 18:15:13.981
         Rank   Owner/ID          Class Job Files     Size Time
        1      papowell@h4+17962    A 17962 (stdin)      6 18:23:30

By default, the lprm command removes the first job in the queue that the user has permission to remove. Also, as shown in the example, you can remove a job by specifying the job ID or the job number. If you specify a user name, you remove all of the user's jobs. This can be dangerous:

        h4: {159} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: 3 printable jobs
         Server: no server active
         Status: job 'papowell@h4+17922' removed at 18:15:13.981
         Rank   Owner/ID          Class Job Files     Size Time
        1      papowell@h4+17962    A 17962 (stdin)      6 18:23:30
        2      papowell@h4+18499    A 18499 /tmp/hi      3 18:56:00
        3      papowell@h4+18501    A 18501 /tmp/there   6 18:56:02
        h4: {160} % lprm papowell
        Printer lp@h4:
          checking perms 'papowell@h4+17962'
          dequeued 'papowell@h4+17962'
          checking perms 'papowell@h4+18499'
          dequeued 'papowell@h4+18499'
          checking perms 'papowell@h4+18501'
          dequeued 'papowell@h4+18501'
        h4: {161} % lpq
        Printer: lp@h4  (printing disabled)
         Queue: no printable jobs in queue
         Status: job 'papowell@h4+17922' removed at 18:15:13.981

The special user all matches all jobs in a print queue. Clearly you should be careful not to specify `lprm all` by accident. Even more dangerous is the following command:

        h4: {162} % lprm -a all

As you might surmise, this removes all print jobs in all queues, which is an excellent way to purge print queues of all jobs.

Prev | Home | Next
Controlling the Print Queue | Up | Print Job Filters