LPRng-HOWTO: 15 Oct 2001 (For LPRng-3.7.9)
Prev | Chapter 4. Print Spooling Tutorial | Next

# 4.5. Printing a File and Checking Status

Try the following commands. The commands appear after the prompt, and sample output that you might see is shown.

        h4: {104} % lpr -V /tmp/hi
        Version LPRng-3.6.14
        sending job 'papowell@h4+238' to lp@localhost
        connecting to 'localhost', attempt 1
        connected to 'localhost'
        requesting printer lp@localhost
        sending control file 'cfA238h4.private' to lp@localhost
        completed sending 'cfA238h4.private' to lp@localhost
        sending data file 'dfA238h4.private' to lp@localhost
        completed sending 'dfA238h4.private' to lp@localhost
        done job 'papowell@h4+238' transfer to lp@localhost

The `lpr -V` (Verbose) option causes lpr to print status output. As you can see from the above lines, it first tries to connect to the lpd server on host `localhost`, then sends a print request (which is accepted), then sends a control file containing information about the job and a data file or files which are copies of the files to be printed.

If you check the `/tmp/lp` file and you will find that a copy of `/tmp/hi` has been written to it. By default, the lpd print spooler acts as a store and forward system, accepting files to be printed, holding them in the print queue, and then forwarding them to the destination system or output device.

You can use the lpq command to view the status of the print job.

        h4: {105} % lpq
        Printer: lp@h4
         Queue: no printable jobs in queue
         Status: job 'papowell@h4+238' removed at 09:39:03.256

If you want to see more status information, use `lpq -l`, `lpq -ll`, or even `lpq -L`. The `-L` provides al`L` the status.

        h4: {106} % lpq -l
        Printer: lp@h4
         Queue: no printable jobs in queue
         Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112
         Status: job 'papowell@h4+238' removed at 09:39:03.256
        h4: {107} % lpq -ll
        Printer: lp@h4
         Queue: no printable jobs in queue
         Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108
         Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110
         Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112
         Status: job 'papowell@h4+238' removed at 09:39:03.256
        h4: {108} % lpq -L
        Printer: lp@h4
         Queue: no printable jobs in queue
         Status: subserver pid 8240 starting at 09:39:03.105
         Status: accounting at start at 09:39:03.105
         Status: opening device '/tmp/lp' at 09:39:03.105
         Status: printing job 'papowell@h4+238' at 09:39:03.106
         Status: no banner at 09:39:03.107
         Status: printing data file 'dfA238h4.private', size 3 at 09:39:03.107
         Status: printing done 'papowell@h4+238' at 09:39:03.107
         Status: accounting at end at 09:39:03.108
         Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108
         Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110
         Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112
         Status: job 'papowell@h4+238' removed at 09:39:03.256

There are different status formats available as well. The `lpq -s` (summary) produces a single line of status per spool queue, while the `lpq -v` (verbose) produces output that is very suitable for processing with programs such as Perl or awk:

        h4: {109} % lpq -s
        lp@h4  0 jobs
        h4: {110} % lpq -v
        Printer: lp@h4
         Printing: no
         Aborted: no
         Spooling: no
         Queue: no printable jobs in queue
         SPOOLCONTROL=
         Status: subserver pid 8240 starting at 09:39:03.105
         Status: accounting at start at 09:39:03.105
         Status: opening device '/tmp/lp' at 09:39:03.105
         Status: printing job 'papowell@h4+238' at 09:39:03.106
         Status: no banner at 09:39:03.107
         Status: printing data file 'dfA238h4.private', size 3 at 09:39:03.107
         Status: printing done 'papowell@h4+238' at 09:39:03.107
         Status: accounting at end at 09:39:03.108
         Status: finished 'papowell@h4+238', status 'JSUCC' at 09:39:03.108
         Status: subserver pid 8240 exit status 'JSUCC' at 09:39:03.110
         Status: lp@h4.private: job 'papowell@h4+238' printed at 09:39:03.112
         Status: job 'papowell@h4+238' removed at 09:39:03.256

If you check the `/tmp/lp` file and you will find that a copy of `/tmp/hi` has been written to it. By default, the lpd print spooler acts as a store and forward system, accepting files to be printed, holding them in the print queue, and then forwarding them to the destination system or output device.

Prev | Home | Next
Restoring Original Configuration | Up | Selecting the Print Queue