AIX 5L SysAdmin I: (Unit 15) – Printers and Queues

Objectives:
—————–
1. Describe the purpose and the benefits of a queuing system
2. Identify the major components that are responsible for processing a print request
3. Add a printer queue and device
4. Submit jobs for printing
5. Manage jobs in the queue

AIX 5.1 Printing Environments:
——————————————–
–> Print subsystems
AIX print subsystem ****
System V print subsysten
–> Print directly to local printer device
–> print directly to a remote printer via a socket program
–> Infoprint Manager (or similar advanced print management system)

AIX Print Subsystem: Advantages:
————————————————–
–> Powerful and flexible printer drivers
–> System Management tools
– Limits fields and options validation
– Easy printer customization
– Single step print device and queue creation
– Support for dial-in administration
–> Customizable spooling subsystem

System V Print Subsystem: Advantages
———————————————————–
– Compatability
– Availability of interface programs
– Security
– Support for forms
– Standard PostScript filters
– Long term strategy

Concepts of Queues:
——————————-
A queue will hold a print job until the printer is available to print.
Queues can point to one or more printers such as /dev/lp0 and /dev/lp1.

Printer Data Flow:
—————————
# qprt -Pps [-c] file
-P – Specify print queue (in this case the ps print queue)
-c – Use spooling (creates a copy of the file at that moment for printing, otherwise, the file may change between the time it is sent to the queue and the actual time that it gets printed.)

1. lp, lpr, qprt – print commands that run enq
2. enq – print command
3. Queue – Printer queue holds print jobs waiting for printing
– Spool directory – copy of file (if requested)
4. qdaemon – Monitors the queue (uses spool file if it exists)
5. Backend Program (piobe) – Actually processes the print job (Virtual Printer Definition)
6. /dev/lp0 – printer device

lp -d queuename filename (Ex. lp -d cr1 filename)
qprt -P queuename filename

System Files Associated with Printing:
———————————————————
/etc/qconfig – queue configuration files
/var/spool/* – spooling directories
/var/spool/lpd/qdir/* – queue requests
/var/spool/qdaemon/* – temporary enqueued files
/var/spool/lpd/stat/* – line printer status information
/var/spool/lpd/pio/@local – virtual printer directories

qdaemon:
—————
1. qdaemon manages queues
2. Started in the /etc/inittab file
3. Invokes the backend programs
4. Optionally records accounting data

The /etc/qconfig File
——————————
lp0: (queue stanza)
device=lp0dev
up = TRUE
discipline = fcfs (default, first come first serve) (sjn – shortest job next)

lp0dev: (device stanza)
file = /dev/lp0 (actual physical device)
backend = /usr/lib/lpd/piobe
header = group
trailer = never
feed = never

Printer Menu:
——————–
# smit spooler
Add a Print Queue – local, manufacturer, model (must load device drivers)
parallel – parallel adapter (ppa0)

Note: Sets up the queue and the device at the same time.

Remote Printing:
————————-
lp1 – host1 – client1

Host1 Setup:
Set up local print queue
Define client machines in /etc/hosts.lpd
Start the lpd daemon

Remote Client Setup:
Configure a remote queue

Client Authorization:
——————————
# smit mkhostslpd – Add print access for a remote client

Start lpd:
————–
# smit mkitab_lpd

Client Machine:
———————–
Add a remote print queue – choose remote instead of local

Submitting Print Jobs:
———————————
–> AIX print systems offer compatibility to System V print commands
–> To submit a job to a queue:
System V BSD AIX
lp lpr qprt

lp -d queuename filename
qprt -P queuename filename

Listing Jobs in a Queue:
————————————
To list jobs in a queue:

System V BSD AIX
lpstat lpq qchk

Note: Use the variable PRINTER=printqueue to set user default printqueues.

Change Characteristics of a Queue:
—————————————————–
# smit chpq

Removing a Queue:
—————————–
# smit rmpq

Managing Queues:
—————————-
# smit pqmanage

Understanding Queue Status:
——————————————-
DEV_BUSY – Printer is busy servicing other print requests
DEV_WAIT – Queue is waiting for the printer
DOWN – Queue is down and no jobs will be serviced from this queue until it is brought up
OPR_WAIT – The queue is waiting for operator intervention
QUEUED – Job is queued and waiting
READY – Everything is ready to receive a print request
RUNNING – Print file is printing
UNKNOWN – Problem with the queue – need to investigate further to determine cause

Bringing Queues Up and Down:
———————————————
# lpstat
# enable printqueue
# disable printqueue

Note: You must be a member of the printq group or root.

Managing Print Jobs:
——————————-
# smit jobs

Cancelling Print Jobs:
——————————–
# smit qcan
or
cancel jobnumber

Job Priority Example
——————————-
# qchk -L
# qpri -Hjobnumber -a priority#

Holding a Job in a Queue:
————————————–
# qchk
# qhld -#jobnumber (puts a print job on hold status)
# qhld -r -#jobnumber (releases a print job from hold status)

Moving a Job between Queues:
———————————————-
# qchk -A (-A means to show all queues)
# qmov -mps -#jobnumber
-m – to move a print job to another queue called ps

Printing-related Directories to Monitor:
——————————————————-
/var/spool/lpd/qdir – Contains queue requests (job description files)
/var/spool/qdaemon – Temporary copies of enqueued files if spooling

Note: Remove any print jobs in the queue that are over a day old, because most likely the user has printed the job somewhere else. Create a script to do this.

Printing Problem Checklist: (Local Printers Only)
————————————————————————
# cat file > /dev/lp0 (sends file directly to the device)
Any output?
No – Check Hardware
——————————-
– Cables
– Printer Online & Ready
– No paper jams
– Not out of paper

Yes – Check Software
——————————–
– qdaemon running
– Check /etc/qconfig
– Queue enabled
– Make sure that /var and /tmp are not full.

FAQs:
———–
Q: Queuing vs Spooling – Which one should I use?
A: It depends on your environment. If you are attempting to print a file that is constantly changing to provide a snapshot of some point in time, you will need to use spooling. Otherwise, the file’s content will continue to change until it works its way through the queue and is passed to the back end. However, spooling requires more disk space. This may concern you. So it really depends on your particular situation.
?????
Q: When I spool a job, does it still queue?
A: Yes. Your choices are really “queue a job” or “queue and spool a job”. The queue mechanism is always used. You are deciding whether you want to make a copy of the job as well.

Q: Why have a queue that prints to two printers?
A: This will help automatically distribute the load between two printers. If one printer is busy, the next job will be routed to the idle printer. Or, if a printer has a paper jam, runs out of paper, or simply is broken, the other printer will automatically do all the work. When you submit a job to a queue, the job could come out on either printer. If you are a nice administrator, you will put those printers physically side by side rather than on two different floors.

Q: Why have two queues that go to the same printer?
A: The printer may have the capability to handle different printer streams. For example, the printer may handle postscript and ASCII print streams. Each queue then is set up for each of the different print streams. You can also give the queues different characteristics. For example, both queues might handle ascii print stream but one may print the characters double-wide and submit the job first come first serve; while the other queue might print the characters normal but process the shortest jobs first.

Q: How do I stop a job from entering the queue?
A: Disabling a queue does not prevent a job from being submitted to that queue. To prevent the job from even entering a queue, you will need to edit the /etc/qconfig file. In the queue stanza, add a line that says “up=FALSE”. Now if someone attempts to submit a job to that queue, they will receive a message saying the queue is not accepting jobs.

Q: I cancel a job but it keeps reprinting. Why?
A: When jobs that are “RUNNING” are canceled, they are reset and put back into the queue. They will be restarted from the beginning.? When you cancel a job that is queued, it is removed from the queue and will not print. Therefore, to cancel a job that is running, cancel it twice. The first cancel will re-queue it, the second cancel will remove it.

Q: I started a long print job, but before it finished, the printer jammed. I don’t want to start the print job from the beginning. How can I start my print job from where it left off?
A: There is a way to do this. It is not graceful however. Go to “smit spooler” and select: Default Print Job Attributes Change / Show Print Queue Characteristics. Then select your queue. Find the line that says: PAGE NUMBER where printing should begin [1] and change the value to the page number that you want to start from. Remember to change the value back or all jobs submitted into that queue with start on the new page number. You might want to create a new queue with this value, submit your job to the new queue and remove the queue when you are done. This prevents the other jobs in the queue from being accidentally sent to the printer with this characteristic.

Q: When qdaemon is determining the order of jobs in a queue, what does it look at first, priority or queue discipline (fcfs or sjn)?
A: Priority is first. If the priority of two jobs are the same, then queue discipline is used.

Leave a Reply

Your email address will not be published. Required fields are marked *

*