Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday 22 November 2013

AIX Printing

Printing
Below given diagram will brief you the working of printer and as well as you can refer the below given detail.

Print Job: It is a unit of work to be run on printer. The system assigns a unique job number to each job it runs.
Queue: The Queue is, where a Print Job is directed. The /etc/qconfig file holds the printer configurations as stanza. In this file you will find name of Queue and to which Queue Device it is associated with.
Queue Device: The Queue Device normally follows the local Queue. It specifies the /dev file (printer device) that should be used.
Note: There can be more than one Queue Device associated with a single Queue.
Daemons For Printer :- “qdaemons”
qdaemon process run in the background and controls the Queue. It is generally started during IPL (initial Program load) with the startsrc command.
Print spooler:
  • The spooler does not normally know what type of job it is queuing. A spooler is not specifically a Print Job spooler
  • It provides a generic spooling function that can be used for queuing various types of jobs including Print JobsQueued to a printer
  • If the spooler back-end program is the piobe command (the printer I/O backend), the Queue is a print Queue
  • If the spooler back-end program is a compiler, the Queue is for compile jobs.
  • The main spooler command is the enq command.
  • Three front-end commands are defined for submitting a Print Job: The lp , lpr , and qprt commands.
Working of Print spooler:
A print request issued by one of these commands is first passed to the enq command, which then places the information about the file in the Queue for the qdaemon to process.
* @(#)33 1.6 src/bos/usr/bin/que/qconfig.sh, cmdque, bos430, 9737A_430
2/4/94 10:45:05
* IBM_PROLOG_BEGIN_TAG
… lines omitted …
* IBM_PROLOG_END_TAG
*
* COMPONENT_NAME: cmdque configuration file for spooling
… lines omitted …
Real printer:
A real printer is the printer hardware attached to a serial or parallel port at a unique hardware device address.
The kernel communicates with the printer hardware & provide an interface between the printer hardware and a virtual printer but not know to the concept of virtual printer.
Local and remote printers:
  • A remote print system allows nodes that are not directly linked to a printer to have printer access
  • The individual nodes must be connected to a network using (TCP/IP).n>
  • It must support the required TCP/IP applications.
EXAMPLE of remote print Queue configuration
* rp0:
* host = hostname
* s_statfilter = /usr/lib/lpd/aixshort
* l_statfilter = /usr/lib/lpd/aixlong
* rq = Queuename
* device = drp0
*
EXAMPLE of local print Queue configuration
*lp0:
* discipline = fcfs
* up = TRUE
* device = dlp0
*
*dlp0:
* backend = /usr/lib/lpd/piobe
* file = FALSE
* access = write
* feed = never
* header = never
* trailer = never
Working of Printer Backend:
  • Receives a list of one or more files to be printed from the qdaemon command.
  • Uses printer and formatting attribute values from the database; overridden by flags entered on the command line.
  • Initializes the printer before Printing a file.
  • Runs filters as necessary to convert the print data stream to a formatsupported by the printer.
  • Provides filters for simple formatting of ASCII documents.
  • Provides support for Printing national language characters.
  • Passes the filtered print data stream to the printer device driver.
  • Generates header and trailer pages.
  • Generates multiple copies.
  • Reports paper out, intervention required, and printer error conditions.
  • Reports problems detected by the filters.
  • Cleans up after a Print Job is cancelled.
  • Provides a print environment that a system administrator can customize to address specific Printing needs.
Commands to submit Print Jobs:-
#enq
#qprt
#lp
#lpr
Status Print Jobs:-
#enq -A
#qchk
#lpstat
lpq
Cancel Print Jobs :
#enq -x
#qcan
#lprm
#cancel
Adding Printer to Print Queue:
The best way to create a new print Queue is by using theSMITinterface.
# smitty

Press F10 to exit
The print Queue lpforu is now installed on the printer lp0.
Editing and Modifying /etc/qconfig :
  • The /etc/qconfig can be edited using text editor. This may be required if a printer definition cannot be removed by any other means.
  • The /etc/qconfig file should never be edited when jobs are processing.
  • When the qdaemon receives notification from enq that a new Job Description File (JDF) exists.
  • If the qdaemon goes into this state while jobs are processing, it is possible for the spooler to hang.
Controlling the print Queue:
  • The lpstatcommand displays information about the current status of the line printer.
# lpstat
O/P →
Queue   Dev  Status  Job  Files  User  PP %  Blks  Cp  Rnk
———————————————————————-
lpforu    lp0   READY
The qchk command displays the current status of the specified Print Jobs, print Queues, or users.
# qchk
Queue Dev Status Job Files User PP % Blks Cp Rnk
—————————————————————————
lpforu lp0 READY
The lpq command reports the status of the specified job or all jobs associated with the specified UserNameand JobNumber variables.
# lpq
Queue Dev Status Job Files User PP % Blks Cp Rnk
—————————————————————————
lpforu lp0 READY
The lpr command uses a spooling daemon to print the named File parameter when facilities become available.
# lpr /etc/passwd
# lpstat
Queue Dev Status Job Files User PP % Blks Cp Rnk
—————————————————————————-
lpforu lp0 RUNNING 3 /etc/passwd root 1 100 1 1 1
Stopping the print Queue:
Check the print Queue using the lpstat command
# lpstat -vlpforu
O/P →
Queue Dev Status Job Files User PP % Blks Cp Rnk
——————————————————————————
lpforu lp0 RUNNING 3 /etc/passwd root 1 100 1 1 1
# enq -D -P ‘lpforu:lp0′
# qchk -P lpforu
O/P →
Queue Dev Status Job Files User PP % Blks Cp Rnk
—— —- ——– — —————- ——– —- — —- — —
lpforu lp0 DOWN 3 /etc/passwd root 1 100 1 1 1
Starting the print Queue:
To restart the print Queue and finish the Print Job after loading the paper
# lpstat -vlpforu
Queue Dev Status Job Files User PP % Blks Cp Rnk
——————————————————————————
lpforu lp0 DOWN 3 /etc/passwd root 1 100 1 1 1
# enq -U -P ‘lpforu:lp0′
# qchk -P lpforu
Queue Dev Status Job Files User PP % Blks Cp Rnk
—— —- ——– — —————- ——– —- — —- — —
lpforu lp0 RUNNING 3 /etc/passwd root 1 100 1 1 1
Flushing a Print Job:
Check the status of the print Queue:
# lpstat -vlpforu
Print the /etc/hosts file to the default printer:
# lpr -dlpforu /etc/hosts
# lpstat -vlpforu
Cancel the Print Job for /etc/passwd using one of the following commands
# qcan -P lpforu -x 3
# cancel 3
# lprm -P lpforu 3
# enq -P lpforu -x 3
Check the print Queue using the qchk command
# qchk -P lpforu
How to check the Print spooler:
There are various commands to check a Print spooler. Basically lpstat and enq command is used
lpstat -plpforu
lpstat -u”root”.
Same output you will get from lpstat -t with the timw stamp.
Setting the timeout on a printer:
Setting the time out on a printer specifies the amount of time, in seconds, the system waits for an operation to complete on a printer. The value must be greater than zero (0).
Note: * fields are mandatory
# smitty spooler

System V Printing:
  • Print spooling only for AIX 5L is enabled by default when AIX 5L Version 5.3 is installed on a system. In order to enable System V Printing, the System V Printing filesets need to be manually installed.
  • The best way to enable System V Printing is by using the SMIT interface.
# smitty

Manage destinations :
Here you can explore and manage printer.

Add a remote printer :

Remove a printer :

lpd Command :
Provides the remote print server on a network. The lpd daemon is the remote print server. It monitors port 515 for print requests. Each request is placed in a directory named /var/spool/lpd .
  • To start the lpd server daemon, type
# startsrc -s lpd
  • To start the lpd server daemon while enabling the display of certain error messages, typespan>
# startsrc -s lpd -a ″ -d″
  • style=”font-family: ‘Liberation Serif’, serif;”>To send logging information to the stderr daemon,Typespan>
# startsrc -s lpd -a ″ -l″
  • To start the lpd server daemon in debugging mode with output going to /tmp/dbglpd.out
# startsrc -s lpd -a ″ -D /tmp/dbglpd.out″
Files Used :
/usr/sbin/lpd Specifies the path to the lpd daemon.
/dev/lp* Contains the names of print devices.
/etc/hosts.equiv Contains the names of hosts allowed to execute commands and print.
/etc/hosts.lpd Contains the names of hosts allowed to print only.
/var/spool/lpd Contains the spool directory for control, status, and data files.
/etc/locks/lpd Contains the PID of the currently running lpd daemon. After a system crash, this PID may need to be deleted. The following error message indicates the problem:
lpd: lock file or duplicate daemon
The lpadmin command :
The lpadmin command is a System V Print Subsystem command that configures the LP print services by defining printers and devices.
  • Add and change printers
  • Remove printers from the service
  • Set or change the system default destination
  • Define alerts for printer faults
  • Mount print wheels
  • Define printers for remote Printing services
Adding or changing the configuration of a local printer →
# lpadmin -p Printer -v Device
Adding or changing the configuration of a remote printer →
# lpadmin -p Printer -s ServerName [!ServerPrinterName ] -v Device
Note :The -p Printer flag is used to configure a new printer or to change the configuration of an existing printer. When you use this form of the lpadmin command, one of the following must be selected:
-v Device, required to configure a local printer
-s ServerNname [ !ServerPrinterName ], required to configure a remote printer
Removing a printer destination : dest (a printer or a class).
 # lpadmin -x [ Destination ] (x is used to remove printer destination)
Importand Point to be remember →
  • If dest is a printer and is the only member of a class, then the class is deleted
  • If dest is all, all printers and classes are removed.
  • No other parameters are allowed with -x
Setting or changing the system default destination :
# lpadmin -d [ Destination ] (-d is used to set to set or change the system default destination)
Importand Point to be remember →
  • If dest is not supplied, then there is no system default destination
  • To unset the system default printer, the user can enter the keyword none.
Setting an alert for a print wheel :
# lpadmin -S Print-Wheel -A AlertType [ -W Minutes ] [ -Q Requests ]
  • The -S Print-Wheel flag is used with the -A Alert-Type flag to define an alert to mount the print wheel when there are jobs Queued for it.
  • The Alert-Types are the same as those available with the -A flag: mail, write, quiet, none, shell-command, and list.
  • -W → by defaults one message will be sent per need to mount the print wheel if -W is not specifief it is equivalent to -W or W 0.
If Minutes is a number greater than zero, an alert is sent at intervals specified by minutes.
  • -Q → this alert is sent when print requests are in waiting.
The switch.prt command :
The Printing subsystem can be switched between AIX 5L Print Spooling and System V Print Spooling with theswitch.prt command. For this command to work, System V print subsystem has to be enabled on the system.


No comments:

Post a Comment