au aixprinting2 pdf

Upload: jlmer

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Au Aixprinting2 PDF

    1/17

    AIX A-Z: Managing printing on AIXSkill Level: Intermediate

    Adam CormanySystems ArchitectScientific Games Corporation

    29 Jun 2010

    Learn how to use the AIX command line to configure and manage print queueseasily.

    IBM has created intuitive commands that assist IBM AIX administrators inconfiguring and managing print queues easily. The System Management InterfaceTool (SMIT) offers a menu-driven interface to manage print queues. However, ifyou're interested in learning to use the command line for such things, this articleoutlines the AIX print queue files and provides a few commands for managing them.

    /etc/qconfig and /etc/qconfig.bin

    Before diving into the printer commands, you need to know the location of the filesdiscussed in this article. Understanding the files and what you're modifying prior toexecuting the actual commands is important; AIX, like other flavors of UNIX andLinux, is not very forgiving if you accidentally delete or modify a file prematurelywithout making a backup of the original. I'm guilty of this crime, as are mostseasoned administrators, but it usually only takes a single (but powerful andsometimes very painful) deletion to learn your lesson.

    On AIX, most system configuration files can be found centrally in /etc. The printqueue configuration files are no different. Listing 1 shows the location of the printerqueue configuration files.

    Listing 1. Printer queue file location

    # ls l /etc/qconfig*

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 1 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    2/17

    -rw-rw-r-- 1 root printq 436 Aug 07 2009 /etc/qconfig-rw-rw---- 1 root printq 5442 Feb 24 19:54 /etc/qconfig.bin

    The /etc/qconfig file contains detailed configuration information on print queues andprint devices. The file is structured in stanzas, or a block of parameters and values

    under a single main keyword. For every queue stanza, at least one device stanzaimmediately follows.

    The /etc/qconfig structure is shown in Listing 2.

    Listing 2. /etc/qconfig stanza structure

    : = : =

    Table 1 shows the parameters and possible values that can be used inside the/etc/qconfig file. These parameters define a print queue.

    Table 1. /etc/qconfig parameters and values

    Parameter Description Values Default

    acctfile Write print accountinginformation to if itexists.

    FALSE (no accounting)

    device Name of the devicestanza.

    This field is required, sothere is no default

    value.

    discipline Printing priority order. fcfs (first come, firstserved)

    fcfs

    sjn (shortest jobs first)

    up Queue status. TRUE (The queue isrunning.)

    TRUE

    FALSE (The queue isnot running.)

    recovery_type If the queue is down,invoke the

    recovery_typeaction.

    queuedown (Leave thequeue down until

    manual interventiontakes place.)

    queuedown

    runscript

    (Execute.)

    retry -T -R

    (Attempt tore-enable the queue

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 2 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    3/17

    after minutes. Ifthe queue isn'tre-enabledsuccessfully, try againin and repeat times before giving

    up.)

    sendmail

    (E-mail thatthe queue is down.)

    The parameters listed in Table 2 define a remote print queue.

    Table 2. Parameters for a remote print queue

    Parameter Description Values

    host Host in which the remote queueis located

    or

    s_statfilter Queue status format (shortversion format)

    /usr/lib/lpd/bsdshort

    (BSD remote system)

    /usr/lib/lpd/aixv2short

    (RT remote system)

    /usr/lib/lpd/attshort

    (AT&T remote system)

    l_statfilter Queue status format (longversion format)

    /usr/lib/lpd/bsdlong

    (BSD remote system)

    /usr/lib/lpd/aixv2long

    (RT remote system)

    /usr/lib/lpd/attslong

    (AT&T remote system)

    rq Remote queue name

    The parameters shown in Table 3 define a print device.

    Table 3. Parameters for a print device

    Parameter Description Values Default

    access Back-end access to

    WRITE (Write access) WRITE

    BOTH (Read and Writeaccess)

    align Send a form-feedcontrol if the printer wasidle.

    TRUE (Send form-feed.) TRUE

    FALSE (Don't sendform-feed.)

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 3 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    4/17

    backend Full path of the backend

    feed Advance Npages if theprinter goes idle.

    (Advance Npages.)

    FALSE

    FALSE (Don't advance

    any pages.)

    file Redirect back-endoutput.

    (Write to.)

    FALSE

    FALSE (Don't write tofile.)

    header Print header page. NEVER (Don't printheader pages.)

    NEVER

    ALWAYS (Always printheader pages.)

    GROUP (Print header

    pages for multiple printjobs by the same user.)

    trailer Print trailer page. NEVER (Don't printheader pages.)

    NEVER

    ALWAYS (Always printheader pages.)

    GROUP (Print headerpages for multiple print

    jobs by the same user.)

    To make sense of all these parameters, Listing 3 provides an example of a simple

    print queue and device that could be found in AIX's /etc/qconfig file.

    Listing 3. /etc/qconfig example

    pac22_ps:device = hp@pac22

    hp@pac22:file = /var/spool/lpd/pio/@local/dev/hp@pac22#hpJetDirect#9100header = nevertrailer = neveraccess = bothbackend = /usr/lib/lpd/pio/etc/piojetd pac22 9100

    It looks like the queue named pac22_psis using device hp@pac22. As far as devicehp@pac22 itself, header and trailer pages are disabled, the device can both readand write to file /var/spool/lpd/pio/hp@pac22#hpJetDirect#9100, and is usingback-end file /usr/lib/lpd/pio/etc/piojetd (JetDirect) on port 9100.

    The file /etc/qconfig.bin is a binary version of /etc/qconfig and is used by a commandnamed qdaemon, which schedules printing jobs via the command enq.

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 4 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    5/17

    A few more files and directories

    Now that you understand the configuration file /etc/qconfig, let's talk about where theactual information is stored for the print queues and devices. Three directories

    reside under /var/spool/lpd. The first directory is /var/spool/lpd/qdir. When printing afile in AIX, a file is created in /var/spool/lpd/qdir that contains environmentinformation of the user who sent the print job, as well as where to find what is beingprinted. Here's an example to explain what you may see in a file under

    /var/spool/lpd/qdir.

    Printing can occur very quickly, so in this example, print jobs were sent to a queuethat is currently disabled to ensure that you still have the files to look at beforethey're completely processed. Now, take a look at the print-disabled print queue,send a print job, and look againbut this time, getting a bit more information withthe t switch. Listing 4 shows the print queue.

    Listing 4. Viewing the print queue

    # lpstat -WQueue Dev Status Job Files User Rnk-------------------- -------------- --------- ------ ------------------ ---------- ---pac22_ps hp@pac22 DOWN

    QUEUED 1165 STDIN.946314 root 1QUEUED 1166 STDIN.1110038 root 2

    atc04_ps hp@atc04 READY

    # echo "test3" | lp -d pac22_psJob number is: 167

    # lpstat -t

    Queue Dev Status Job Name From ToSubmitted Rnk Pri Blks Cp

    ------- ----- --------- --------- --- --- ----- ---pac22_p hp@pa DOWN

    QUEUED 165 STDIN.946314 root root03/03/10 13:40:38 1 15 1 1

    /var/spool/qdaemon/tb_3iEaQUEUED 166 STDIN.1110038 root root

    03/03/10 13:44:48 2 15 1 1/var/spool/qdaemon/tj3Ybya

    QUEUED 167 STDIN.827498 cormany cormany03/03/10 13:47:03 3 15 1 1

    /var/spool/qdaemon/t1ZEgEaatc04_p hp@at READY

    Good. The print job that I created is there and queued. Now, look to see what filesare in /var/spool/lpd/qdir:

    # ls -l /var/spool/lpd/qdirtotal 24-rw-rw---- 1 root printq 1663 Mar 03 13:47 n0cormany:pac22_ps$#@!EgEc-rw-rw---- 1 root printq 1913 Mar 03 13:40 n0root:pac22_ps$#@!3iEc-rw-rw---- 1 root printq 1919 Mar 03 13:44 n0root:pac22_ps$#@!Ybyc

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 5 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    6/17

    It's easy in this example to discern which file belongs to the print job I just sent, butwhat if the print queue has been down for hours and hundreds of print jobs arequeued and waiting to print? One method you can use to find which file you need isby looking at the file name listed in lpstat t. In this example, the file t1ZEgEawas created under /var/spool/qdaemon. By looking at the characters 4 through 6 of

    the file name (for example, EgE), you can surmise n0cormany:pac22_ps$#@!EgEcis what you want to look at.

    Listing 5 shows the messy output.

    Listing 5. Print job environment information

    # cat 'n0cormany:pac22_ps$#@!EgEc'

    000001167#@%!: 0 0 15 0 0 12676420231 1 3 3cormany 0

    REAL_USER=cormanyLOGIN_USER=rootREAL_GROUP=atcGROUPS=atc,support,sshdAUDIT_CLASSES=RLIMIT_CPU=9223372036854775807RLIMIT_FSIZE=18014398509481984RLIMIT_DATA=18014398509481984RLIMIT_STACK=8388608RLIMIT_CORE=18014398509481984RLIMIT_RSS=18014398509481984RLIMIT_NOFILE=9223372036854775807RLIMIT_THREADS=9223372036854775807RLIMIT_NPROC=9223372036854775807RLIMIT_CPU_HARD=9223372036854775807RLIMIT_FSIZE_HARD=18014398509481984RLIMIT_DATA_HARD=18014398509481984RLIMIT_STACK_HARD=8388608RLIMIT_CORE_HARD=18014398509481984RLIMIT_RSS_HARD=18014398509481984RLIMIT_NOFILE_HARD=9223372036854775807RLIMIT_THREADS_HARD=9223372036854775807RLIMIT_NPROC_HARD=9223372036854775807UMASK=22PAG_DATA=

    USRENVIRON:_=/usr/bin/lpLANG=en_USLOGIN=cormanyG_BROKEN_FILENAMES=1VISUAL=viXREMOTETMPDIR=/home/cormanyPATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/bin:/usr/bin/X11:/sbin:

    /usr/java5/jre/bin:/usr/java5/bin:/usr/ushare/bin:/usr/local/bin:.:LC__FASTMSG=trueEDITOR=viHISTFILE=/home/cormany/history_1040542

    LOGNAME=cormanyMAIL=/usr/spool/mail/cormanyLOCPATH=/usr/lib/nls/locPS1=#USER=cormanyAUTHSTATE=NISSHELL=/bin/kshODMDIR=/etc/objreposHISTSIZE=100HOME=/home/cormanyTERM=xtermMAILMSG=[YOU HAVE NEW MAIL]

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 6 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    7/17

    PWD=/home/cormanyTZ=America/New_YorkENV=/home/cormany/.kshrcA__z=!LOGNAMESYSENVIRON:LOGNAME=cormanyNAME=cormanyTTY=/dev/pts/7

    This information may look like garbage, but it can be very useful. An administratorcan view this file and try to discern why a print job has failed by looking at the usersenvironment, which is included in the file.

    The second directory is /var/spool/lpd/stat. As its name references, this directorycontains status information on the print devices. Each device will have a file in thisdirectory. Unfortunately, the files are not in ASCII format, so there is little to viewhere, but its good to know where these files reside.

    The third and final directory in /var/spool/lpd is /var/spool/lpd/pio. This directory

    contains information on the back end that qdaemon uses. This is where the printqueue typically reads and writes its back-end data.

    The directory /var/spool/qdaemon is an important directory in the printing process onAIX. It contains a copy of the actual file being printed, as Listing 6 shows.

    Listing 6. /var/spool/qdaemon files

    # ls -l /var/spool/qdaemontotal 24-rw-r----- 1 cormany printq 6 Mar 03 13:47 t1ZEgEa-rw-r----- 1 root printq 5 Mar 03 13:40 tb_3iEa

    -rw-r----- 1 root printq 6 Mar 03 13:44 tj3Ybya# cat /var/spool/qdaemon/t1ZEgEatest3

    Creating a printer queue

    Creating a print queue in AIX using the command line is easy. You do so using thecommand mkque. Here are a few options that you can use when executing mkque:

    -a ' = '. Assign values to the attributes

    explained earlier in this article. -D. Make this print queue the default queue.

    -q . Name the queue .

    Now that you know the basics, create a new print queue using the code in Listing 7.

    Listing 7. Creating a new print queue

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 7 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    8/17

    # mkque -q AMDC79 -a 'recovery_type = sendmail cormany'

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 dumm UNKNOWN

    Creating a printer queue device

    With a new print queue created, attach the queue to a newly created print queuedevice. By using the command mkquedev, you can create new print queue devicesand add an existing queue quickly. Here are a few options that you can use whenexecuting mkquedev:

    -a ' = '. Assign values to the attributesexplained earlier in this article.

    -d . Name the queue device .

    -q . Add to .

    Now that you know the basics, you can create a new print queue device and attachthe queue you just created to it. Listing 8 shows the code.

    Listing 8. Creating a new print queue device

    # mkquedev -q AMDC79 -d hp@pac22 -a 'header = always' -a 'backend =/usr/lib/lpd/pio/etc/piojetd pac22 9100

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 READY

    The file /etc/qconfig now contains the new queue and device shown in Listing 9.

    Listing 9. New queue information in /etc/qconfig

    AMDC79:device = hp@pac22recovery_type = sendmail cormany

    pa@pac22:header = alwaysbackend = /usr/lib/lpd/pio/etc/piojetd pac22 9100

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 8 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    9/17

    Changing printer queue and device attributes

    Now you have a new queue and device, and you can begin changing some of theattributes. The commands chque and chquedev allow you to change attributes to a

    new value.

    Here are the options that you can use when executing chque:

    -a . Change to have a value of.

    -q . Query the printer's queue named .

    The options for chquedev are similar:

    -a . Change to have a value of.

    -d . Query the device named .

    -q . Query the printer's queue named .

    Start by changing the queue's recovery_type to run a script that fixes the queue ifit goes down:

    # chque -q AMDC79 -a 'recovery_type = runscript /home/cormany/fix_printer'

    Now, change the queue's device attribute header to group and add the attributetrailer:

    # chquedev -q AMDC79 -d hp@pac22 -a 'header = group' -a 'trailer = group'

    The changes should now be complete. To verify, look in /etc/qconfig:

    AMDC79:device = hp@pac22recovery_type = runscript /home/cormany/fix_printer

    hp@pac22:trailer = groupheader = groupbackend = /usr/lib/lpd/pio/etc/piojetd pac22 9100

    Viewing print queue and queue devices

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 9 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    10/17

    Like most commands in AIX, there are several ways to accomplish the same task.Viewing information from /etc/qconfig is no different. The preferred and safer methodof viewing queue and queue device information is to use lsque and lsquedev.

    By using lsque, you see the queue information only as follows:

    # lsque -q AMDC79AMDC79:

    device = hp@qaljlab3recovery_type = runscript /home/cormany/fix_printer

    By using lsquedev on the print queue in the code above, you'll see the devicequeue information only as shown below:

    # lsquedev -q AMDC79 -d hp@pac22hp@pac22:

    trailer = groupheader = groupbackend = /usr/lib/lpd/pio/etc/piojetd pac22 9100

    Another handy option in both lsque and lsquedev is the ability to createcolon-delimited output of the queue and queue device. This format of output can beuseful if scripting print-management functions. Listing 11 shows the output of lsqueand lsquedev.

    Listing 11. lsque and lsquedev delimited output

    # lsque -q AMDC79 -c

    #name:device:discipline:up:acctfile:host:s_statfilter:l_statfilter:rqAMDC79:hp@pac22:fcfs:TRUE:FALSE::::

    # lsquedev -q AMDC79 -d hp@qaljlab3 -c#name:file:access:feed:header:trailer:backend:alignhp@pac22:FALSE:write:never:group:group:/usr/lib/lpd/pio/etc/piojetd pac22 9100:FALSE

    Removing virtual printers

    Removing print queues and print queue devices is easy in AIX. IBM has providedthe commands rmque and rmquedev to handle such a task.

    To remove the print queue and device previously created in this article, simplyexecute the code in Listing 12.

    Listing 12. Removing print queues and print queue devices

    # rmquedev -q AMDC79 -d hp@pac22# rmque -q AMDC79

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 10 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    11/17

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READY

    Terminating a print job

    There are several ways to terminate print jobs in AIX. You could use cancel, lprm,or qcan among many other commands. This article focuses on just cancel.

    The command cancel is straightforward. You can specify either an individual printjob number, a group of print job numbers, or the entire queue. Take a look at thequeue AMDC79 again. It looks like the print jobs are starting to back up in thedisabled queue. The first example only terminates the first print job, 1169 (seeListing 13).

    Listing 13. lpstat output

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    QUEUED 1169 STDIN.1134828 root 1 1QUEUED 1171 STDIN.1134838 root 1 2QUEUED 1172 STDIN.1134840 root 1 3QUEUED 1173 STDIN.1134842 root 1 4QUEUED 1174 STDIN.1134844 root 1 5

    QUEUED 1175 STDIN.1134846 root 1 6QUEUED 1176 STDIN.1134592 root 1 7

    First, verify the variable PRINTER is set to AMDC79. Then, select the print job youwant to terminate (1169) and cancel it. Listing 14 shows the code.

    Listing 14. Canceling a single print job

    # echo $PRINTERAMDC79# cancel 1169# lpstat -W

    Queue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    QUEUED 1171 STDIN.1134838 root 1 2QUEUED 1172 STDIN.1134840 root 1 3QUEUED 1173 STDIN.1134842 root 1 4QUEUED 1174 STDIN.1134844 root 1 5QUEUED 1175 STDIN.1134846 root 1 6QUEUED 1176 STDIN.1134592 root 1 7

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 11 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    12/17

    This is good; the first print job was removed, but the queue is still down. Now,remove jobs 1171, 1173, and 1176. Listing 15 shows the code.

    Listing 15. Canceling multiple print jobs

    # cancel 1171 1173 1176# lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    QUEUED 1172 STDIN.1134840 root 1 3QUEUED 1174 STDIN.1134844 root 1 5QUEUED 1175 STDIN.1134846 root 1 6

    From there, you can terminate the rest of them. Listing 16 shows the code.

    Listing 16. Canceling the entire print queue

    # cancel AMDC79# lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    Disabling and enabling print queuesAll the print jobs have been removed from print queue AMDC79, and the supportstaff says the printer has been fixed. It's time to see if the printer is working again.AIX offers the commands disable and enable to accomplish these tasks.

    Listing 17 shows the code for enabling a print queue.

    Listing 17. Enabling the print queue

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    # enable AMDC79

    # lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READY

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 12 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    13/17

    atc04_pcl hp@atc04 READYAMDC79 hp@pac22 READY

    To re-enable the print queue, simply type enable ..

    Easy, eh? But waitthe department has received word that the print queue is backup, and now they're sending hundreds of jobs to it. That's great, right? Next phonecall you receive is from the support staff saying that there's another issue they didn'tsee with the printer. Now, you have hundreds of jobs coming through the printqueue, and you need to terminate the jobs and disable the printer immediately! Don'tpanic: disable can do the job for you. By supplying the switch c to disable allprint jobs in the queue, the jobs are removed and the queue is disabled. Whew, thatwas a close one! Listing 18 shows the code.

    Listing 18. Disabling the print queue

    # disable c AMDC79# lpstat -WQueue Dev Status Job Files User Blks Rnk-------------------- -------------- --------- ------ ------------------ -------- ---- ---pac22_ps hp@pac22 READYatc04_pcl hp@atc04 READYAMDC79 hp@pac22 DOWN

    Print queue status

    This article has talked about adding, removing, and modifying queues, andthroughout I've used the standard lpstat command that most seasoned UNIX

    users know. But note that there are a lot of other commands in the AIX arsenal ofutilities. To view the status of a print queue, you could use lpstat, qchk, lpq, orqstatus. Because lpstat is so widely used, let's take a look at anothercommand. The command qchk can be useful while looking at print queue statusinformation.

    Here are a few options to think about when using qchk:

    -# . View the status of a specific print job.

    -A. Look at all print queues.

    -L. View the output in long format.

    -P . View the status of .

    -q. View the status of the default printer.

    -u . View the status of jobs sent by .

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 13 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    14/17

    -W. View the output, showing longer names of queues, devices, and soon.

    -w . Refresh output every seconds until thequeue is empty.

    As a reminder regarding the q switch displaying the default printer, in AIX thedefault printer is the queue first in /etc/qconfig.

    One handy usage of qchk is to watch print jobs sent by a user or to view a specificprint job. For example, a user named Xanderhas sent a few jobs to a print queueand claims he isn't getting his printouts when another user named Paulhas gottenhis earlier in the day. To quickly and easily find all print jobs sent by Xander, youcould use qchk, as shown in Listing 19.

    Listing 19. View print jobs by user

    # qchk -u xanderQueue Dev Status Job Files User PP % Blks Rnk------- ----- --------- --- ------------------ ---------- ---- -- ----- ---pac22_p hp@pa DOWN

    QUEUED 191 tmp1238 xander 4 1QUEUED 192 tmp1323 xander 4 1QUEUED 193 tmp1347 xander 4 1QUEUED 194 tmp1789 xander 4 1QUEUED 195 tmp9831 xander 4 1

    Found them! As Xander said, none of his print jobs have gone through. It looks likethe printer queue is down and some troubleshooting is needed. After a quick phonecall, you find out that the printer ran out of paper. After the paper has been

    replenished and the queue has been re-enabled, all of Xander's print jobs haveprinted successfully. Now, verify that Xander isn't waiting on any other print jobs:

    # qchk -u xanderQueue Dev Status Job Files User PP % Blks Rnk------- ----- --------- --- ------------------ ---------- ---- -- ----- ---pac22_p hp@pa READY

    Nice work. Another possible disaster adverted. Just to be on the safe side, youdecide to watch the busy queue for a while but don't want to keep retyping thecommands or pressing Escape K. Here's a nice way to watch the queue and let the

    output refresh on its own. In this example, the queue output refreshes every 5seconds until the queue has been completely emptied:

    # qchk -P pac22_ps -w 5

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 14 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    15/17

    Conclusions

    After reading this article, you should have a better understanding of how to manageprint queues and print queue devices in AIX, including how to create them and how

    to modify or manage them. Knowing more about how the printers and the queuesare set up on your system is important. A lot of people don't realize how manysettings are in a queue that can be changed easily. You may be able to makesomeone's day by modifying their printer to suit their needs. Good luck!

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 15 of 17

    http://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/
  • 7/31/2019 Au Aixprinting2 PDF

    16/17

    Resources

    Learn

    qconfig: Learn more about the qconfig file.

    mkque: Learn more about the mkque command.

    mkquedev: Learn more about the mkquedev command.

    chque: Learn more about the chque command.

    chquedev: Learn more about the chquedev command.

    lsque: Learn more about the lsque command.

    lsquedev: Learn more about the lsquedev command.

    rmque: Learn more about the rmque command.

    rmquedev: Learn more about the rmquedev command.

    AIX and UNIX developerWorks zone: The AIX and UNIX zone provides awealth of information relating to all aspects of AIX systems administration andexpanding your UNIX skills.

    New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.

    Technology bookstore: Browse the technology bookstore for books on this andother technical topics.

    Discuss

    developerWorks blogs: Check out our blogs and get involved in thedeveloperWorks community.

    Follow developerWorks on Twitter.

    Get involved in the My developerWorks community.

    Participate in the AIX and UNIX forums:

    AIX Forum

    AIX Forum for developers

    Cluster Systems Management

    IBM Support Assistant Forum

    Performance Tools Forum

    Virtualization Forum

    More AIX and UNIX Forums

    developerWorks ibm.com/developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 16 of 17

    http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.files/doc/aixfiles/qconfig.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mkque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mkquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/lsque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/lsquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds4/rmque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds4/rmquedev.htmhttp://www.ibm.com/developerworks/aix/http://www.ibm.com/developerworks/aix/newto/http://www.ibm.com/developerworks/apps/SendTo?bookstore=safarihttp://www.ibm.com/developerworks/blogs/http://www.ibm.com/developerworks/communityhttp://twitter.com/developerworkshttps://www.ibm.com/developerworks/mydeveloperworkshttp://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=747&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=905&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=907&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=935&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=749&cat=72http://www.ibm.com/developerworks/forums/forum.jspa?forumID=748http://www.ibm.com/developerworks/forums/dw_auforums.jsphttp://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/developerworks/forums/dw_auforums.jsphttp://www.ibm.com/developerworks/forums/forum.jspa?forumID=748http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=749&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=935&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=907&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=905&cat=72http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=747&cat=72https://www.ibm.com/developerworks/mydeveloperworkshttp://twitter.com/developerworkshttp://www.ibm.com/developerworks/communityhttp://www.ibm.com/developerworks/blogs/http://www.ibm.com/developerworks/apps/SendTo?bookstore=safarihttp://www.ibm.com/developerworks/aix/newto/http://www.ibm.com/developerworks/aix/http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds4/rmquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds4/rmque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/lsquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/lsque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds1/chque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mkquedev.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mkque.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.files/doc/aixfiles/qconfig.htm
  • 7/31/2019 Au Aixprinting2 PDF

    17/17

    About the author

    Adam Cormany

    Adam Cormany is currently a systems architect, but he has also been aUNIX systems engineer, a UNIX administrator, and operations managerfor Scientific Games Corporation. Adam has worked extensively withAIX as well as in Solaris and Red Hat Linux administration for morethan 10 years. He is an IBM eServer-Certified Specialist in pSeries AIXSystem Administration. In addition to administration, Adam hasextensive knowledge of shell scripting in Bash, CSH, and KSH as wellas programming in C, PHP, and Perl. You can reach Adam [email protected].

    ibm.com/developerWorks developerWorks

    AIX A-Z: Managing printing on AIX Trademarks Copyright IBM Corporation 2010. All rights reserved. Page 17 of 17

    http://localhost/var/www/apps/conversion/current/tmp/scratch27913/[email protected]://www.ibm.com/developerworks/ibm/trademarks/http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/http://localhost/var/www/apps/conversion/current/tmp/scratch27913/[email protected]