/usr/sbin/exiqgrep Searches for strings in the mail queue.

/usr/sbin/exiqsumm Summarizes the current contents of the mail queue.

On the ExamIt is not necessary to know the detailed configuration options of each MTA for the LPI 102 exam. You need to understand the basic purpose of an MTA and know how to handle aliasing and email forwarding. You should also be familiar with the sendmail-compatibility commands included with qmail, postfix, and exim.

Name mail Syntax mail[options]

Description A mail processing system that can be used to both send and read Internet mail.

Example Start mail in interactive mode to read your mail: #mail Sendanemailfromthecommandline: #mail-s"Thisisthesubject"-c"root"adamh h.e.l.lo .

Cc:root This example shows some command-line options of mail mail, specifically the ability to indicate a subject and Cc: list. In this example, the body of the message was given interactively, ending with a "." on a line by itself. You could also cat cat an existing file and redirect an existing file and redirect STDOUT STDOUT to the to the mail mail program to make this noninteractive: program to make this noninteractive: #echo"Messagebody">/tmp/body.msg #cat/tmp/body.msg|mails"Thisisthesubject"c"root"adamh This email was delivered successfully because there was a user account named adamh adamh on this system. What if we want to create aliases for this user so he can get email to the same inbox via a number of different email addresses? Sendmail handles aliasing with the file on this system. What if we want to create aliases for this user so he can get email to the same inbox via a number of different email addresses? Sendmail handles aliasing with the file /etc/aliases /etc/aliases: #cat/etc/aliases # #AliasesinthisfilewillNOTbeexpandedintheheaderfrom #Mail,butWILLbevisibleovernetworksorfrom/bin/mail.

# #>>>>>>>>>>Theprogram"newaliases"mustberunafter #>>NOTE>>thisfileisupdatedforanychangesto #>>>>>>>>>>showthroughtosendmail.

#Basicsystemaliases--theseMUSTbepresent.

mailer-daemon:postmaster postmaster:root

#Generalredirectionsforpseudoaccounts.

bin:root daemon:root adm:root lp:root

#Usermaintainedaliases adam:adamh adam.haeder:adamh haeder:adamh The lines in this file take the format "alias: user account". After you make modifications to this file, you must run the command newaliases newaliases as root. The as root. The newaliases newaliases command will take the command will take the /etc/aliases /etc/aliases file and convert it to a hashed Berkeley DB file. This is a standard method of configuration for sendmail; changes are made to text-based configuration files, and are then converted to Berkeley DB files for quicker parsing. Emails that are sent to file and convert it to a hashed Berkeley DB file. This is a standard method of configuration for sendmail; changes are made to text-based configuration files, and are then converted to Berkeley DB files for quicker parsing. Emails that are sent to adam adam, adam.haeder adam.haeder, or haeder haeder will all be delivered to the user will all be delivered to the user adamh adamh.

What if you want to forward all emails sent to a specific user account to another account, either on the same system or to a different email address? The easiest way to accomplish this is with the file ~/.forward ~/.forward. This is simply a text file that lives in a user"s home directory and contains one or more email addresses to forward all mail to. These can be either local addresses (usernames) or complete Internet email addresses ([email protected]). The advantage of the ~/.forward ~/.forward file is that the user can maintain it himself, whereas the file is that the user can maintain it himself, whereas the /etc/aliases /etc/aliases file must be maintained by the root user. file must be maintained by the root user.

Name Mail queuing Description Sendmail is an intelligent mail agent, and it tries to deliver mail even when failures occur. For example, if a user attempts to send email to [email protected] [email protected], and the mail server for hostname.com is turned off, sendmail will be unable to make a connection to TCP port 25 on the mail server for hostname.com and consequently won"t be able to deliver the mail. Instead of giving up, sendmail will place the email in a queue and attempt redelivery. The default action of sendmail is to attempt redelivery of queued mail every 4 hours for 5 days before giving up and sending a "Delivery Failure" notification to the original sender. Queued mail is stored in the directory /var/spool/mqueue /var/spool/mqueue and is managed by the program and is managed by the program mailq mailq.

mailq Syntax mailq[options]

Description Displays the items in the mail queue.

Example Attempt to send mail to a host that is not currently accepting email: #echo"FailureTest"[email protected]

Viewthemailqueue #mailq o1591AmX0056157182FriFeb503:01MAILER-DAEMON 8BITMIME(Deferred:Connectionrefusedbyunknown.com.) This mail will remain in the queue for a default time of 5 days, with retry attempts every 4 hours. You can force sendmail to attempt a resend of every item in the mail queue with the command sendmail q v sendmail q v.

Chapter18.Manage Printers and Printing (Topic 108.4)

Chapter18 contains the final Objective in Topic 108: contains the final Objective in Topic 108: Objective 4: Manage Printers and Printing Candidates should be able to manage print queues and user print jobs using CUPS and the LPD compatibility interface. Weight: 2.

Objective 4: Manage Printers and Printing As long as the paperless office remains a myth, printing will be an important aspect of the computing experience. Even if you don"t deal with it on a daily basis, as a system administrator printing will inevitably be an important part of your job.

This topic also covers the setup, administration, and use of the Common Unix Protocol (CUPS) and the Line Printer Daemon (LPD) legacy interface (lpr, lprm lprm, lpq lpq, etc.). Although they are not covered in the current LPI Objectives, this chapter also includes an introduction to other printing systems that may be used on Linux systems.

In the current LPI exams, this objective weight was changed, the content shrank from three objectives to one, and the objective was moved to the Essential System Services topic. Bear in mind that CUPS is the main thing to know here, but CUPS"s compatibility with the legacy LPD protocol are also required.

An Overview of Printing The various printing implementations available for Linux systems have a basic architecture in common. In every printing system, a central daemon (or service) receives print jobs, via either a user command (such as lpr lpr) or the network. The print job is then processed through input filters if necessary, and sent to either a local printer or another printing daemon.

Printing doc.u.ments is a slow and error-p.r.o.ne process. Printers accept data in small amounts. They are p.r.o.ne to run out of paper, jam, and go offline for other reasons. Printers also must accept requests from multiple system users. As a result, by design, the end user is isolated from printing functions on most computer systems. This isolation comes in the form of a print queue print queue, which holds print requests until the printer is ready for them. It also manages the order in which print jobs are processed. Feeding print jobs to printers is often called spooling spooling, and the program that manages the print queues is sometimes called a spooler spooler. It can also be called a scheduler scheduler.

BSD and System V Interfaces Historically, there have been two competing printing implementations on Unix systems, one invented for BSD Unix and another for System V (SysV) Unix. Although the implementations are similar, they have completely different commands. The BSD printing commands include lpd lpd, lpr lpr, lprm lprm, and lpc lpc. The System V printing commands include lp lp, enable enable, disable disable, cancel cancel, lpstat lpstat, and lpadmin lpadmin. On System V-based systems, the lpadmin lpadmin command manages print queues. There is no equivalent to it on BSD-based systems, other than to simply edit command manages print queues. There is no equivalent to it on BSD-based systems, other than to simply edit /etc/printcap /etc/printcap. Other than lpadmin lpadmin, there is a one-to-one relationship between BSD and System V printing commands. However, the internal details, such as files used, vary considerably.

Older Linux distributions tended to use a port of the BSD lpd lpd code (and related commands). Due to various security issues with the BSD code (mostly the overuse of the code (and related commands). Due to various security issues with the BSD code (mostly the overuse of the root root account through SUID executables), current distributions have largely dropped the BSD code in favor of CUPS. account through SUID executables), current distributions have largely dropped the BSD code in favor of CUPS.

LPRng LPRng is a complete rewrite of the BSD utilities. It is designed to be portable and secure. Unlike the BSD utilities, the client programs do not need to run SUID. The server (still called lpd lpd) is a complete implementation of the RFC 1179 Line Printer Daemon Protocol. It also includes lp lp and and lpstat lpstat commands for System V compatibility. commands for System V compatibility.

Although LPRng is a complete rewrite, configuration is still mostly the same as for the BSD utilities. It still uses /etc/printcap /etc/printcap (described later in this chapter). It also has two additional configuration files: (described later in this chapter). It also has two additional configuration files: /etc/lpd.conf /etc/lpd.conf, which controls details of LPRng"s lpd lpd, and /etc/lpd.perms /etc/lpd.perms, which configures access controls for lpd lpd.

Sometimes it"s necessary to integrate the printing server into a heterogeneous infrastructure, such as to serve systems using the LPD legacy protocol. The embedded package cups-lpd cups-lpd is the CUPS Line Printer Daemon (LPD) mini-server supporting these legacy client systems. is the CUPS Line Printer Daemon (LPD) mini-server supporting these legacy client systems. cups-lpd cups-lpd does not act as a standalone network daemon, but instead operates using the Internet does not act as a standalone network daemon, but instead operates using the Internet inetd inetd or or xinetd xinetd super-server. super-server.

The LPD server will listen on the default port specified in the /etc/services /etc/services file: file: printer515/tcpspooler#lineprinterspooler printer515/udpspooler#lineprinterspooler LPRng is available from CUPS is a more recent printing system that was initially designed to support the Internet Printing Protocol (IPP) but has evolved into a drop-in replacement for both the BSD and System V utilities, including client replacements for RFC 1179 (lpd protocol) support. protocol) support.

Although it retains backward compatibility with older printing systems, the internal details of CUPS are significantly different. The server component cupsd cupsd handles queuing, and includes a web server for configuration and management. Nearly everything can be configured through the web interface or the included handles queuing, and includes a web server for configuration and management. Nearly everything can be configured through the web interface or the included lpadmin lpadmin command. The various configuration files in the command. The various configuration files in the /etc/cups /etc/cups directory rarely need to be edited by hand. directory rarely need to be edited by hand.

The CUPS web interface, shown in Figure18-1 Figure18-1, is available on the machine at management web interface In order to implement or troubleshoot a printing system, it"s very important to understand the data flow and the steps taken on the server and client side. In the case of CUPS, these are: 1. A print job is generated by an application locally on the client side.

2. The print job is sent to the print server specified by the protocol selected for that queue (e.g., IPP or CIFS).

3. On the CUPS server, the spooler process cupsd cupsd fetches the data stream and saves it in the print spool directory. The default directory is fetches the data stream and saves it in the print spool directory. The default directory is /var/spool/cups /var/spool/cups.

4. If an input filter is specified in the configuration, CUPS will pa.s.s the job to it. In any case, after any filtering, the job is sent to the backend. Many filters create formats for particular printers from generic input, such as PostScript or a PDF.

5. The backend sends the printer-specific data to the printer.

6. Once the job is completed, cupsd cupsd removes the respective files from the spool directory, depending on the retention time configured. removes the respective files from the spool directory, depending on the retention time configured.

CUPS is available from printing overview On Linux, the CUPS printing system consists of the following elements: cupsd This daemon is started at boot time and runs continuously, listening for print requests directed at multiple printers. When a job is submitted to a print queue, cupsd cupsd handles jobs on that queue. The copy exits when the queue is emptied. handles jobs on that queue. The copy exits when the queue is emptied.

/etc/cups/cupsd.conf This file configures the cupsd cupsd daemon. It is normally located in the daemon. It is normally located in the /etc/cups /etc/cups directory. directory.Each line in the file can be a configuration directive, a blank line, or a comment. The configuration directives are intentionally similar to those used by the popular Apache web server software.

/etc/cups/printers.conf This file defines available local printers. It is generated automatically by cupsd cupsd when printers are added, deleted, or changed. This file shouldn"t be changed manually. when printers are added, deleted, or changed. This file shouldn"t be changed manually.

/etc/printcap This file is still present on the system to allow older printing applications that rely on it to keep functioning. Under CUPS, the file is automatically generated by cupsd cupsd from the from the /etc/cups/printers.conf /etc/cups/printers.conf file. All changes to the file are lost if the CUPS service is restarted. file. All changes to the file are lost if the CUPS service is restarted.

lp The lp lp (line print) program submits both files and information piped to its standard input to print queues. (line print) program submits both files and information piped to its standard input to print queues.

lpq This program queries and displays the status and contents of print queues.

lprm This program removes print jobs from print queues.

lpadmin This program configures printer and cla.s.s queues provided by CUPS. It can also be used to set the server default printer or cla.s.s.

lpc Nowadays, lpc lpc provides limited control over printer and cla.s.s queues provided by CUPS. It can also be used to query the state of queues. The command provides limited control over printer and cla.s.s queues provided by CUPS. It can also be used to query the state of queues. The command lpadmin lpadmin should be used instead. should be used instead.

Spool directories The cupsd cupsd daemon uses daemon uses /var/spool/cups /var/spool/cups for the spooling of data awaiting printing. for the spooling of data awaiting printing.

Print jobs Each print request submitted is spooled to a queue and a.s.signed a unique number. The print jobs can be examined and manipulated as needed.

Other files are also used by particular parts of the system, such as input filters.

CUPS backends Several backends are available for CUPS: parallel, serial, SCSI, and USB ports, as well as network backends that operate via the Internet Printing Protocol (HTTP, HTTPS, and IPP), JetDirect (AppSocket port 9100), Line Printer Daemon (LPD), CIFS (which used to be called SMB) protocols, and more. PDF generators are also available. These backends usually live in the directory /usr/lib/cups/backend /usr/lib/cups/backend, and can be compiled programs or scripts written in any scripting language, such as Perl or Python.

The backend is always the last program executed for processing a print job. Table18-1 Table18-1 lists the most popular backends. lists the most popular backends.

Table18-1.Backend processors under CUPS

Backend URI syntax Example URI Parallel parallel:/dev/lpnumber parallel:/dev/lp0 USB usb://make/model?serial= number number usb://vendor/printer%201000?serial=A1B2C3 ipp ipp://host/printers/queue ipp://host/printers/printer1000 LPD lpd://host/queue lpd://host/printer socket socket://host:port socket://ip:9100 CIFS (Common Internet Filesystem, the protocol Microsoft Windows-based systems use for file and printer communication across a network) see the smbspool(8) manpage smb://user:[email protected]/host/share

CUPS filters The core of the CUPS filtering system is based on Ghostscript, part of the GNU project. It consults PPD files, which are an industry standard for representing printer capabilities (two-sided printing, four-to-a-page, etc.).

For PostScript printers, the PPD file contains the printer-specific options (and nothing else) together with the corresponding PostScript code snippets that must be sent to the PostScript interpreter in order to activate a certain option.

For non-PostScript printers, the PPD file contains additional information about which printer driver program to use and the options available for the particular driver. If several drivers can be used for a given printer, several PPD files are found on the system.

Depending on the printer-specific options set for a certain print job (e.g., -o PageSize=A4 -o PageSize=A4), the filter system reads the suitable PostScript code snippets (the so-called "PostScript invocation values") from the PPD file and inserts them in the PostScript data stream.

The original data has a MIME type determined by configuration options in /etc/cups/mime.types /etc/cups/mime.types. If the type is not application/postscript application/postscript, the data is converted to PostScript according to the /etc/cups/mime.convs /etc/cups/mime.convs configuration file. For example, configuration file. For example, text/plain text/plain is converted to PostScript with the is converted to PostScript with the /usr/lib/cups/filter/texttops /usr/lib/cups/filter/texttops program. program.

These filter files are usually found in the directory /usr/lib/cups/filter /usr/lib/cups/filter and, like CUPS backends, can be compiled code or sh.e.l.l scripts. and, like CUPS backends, can be compiled code or sh.e.l.l scripts.

Managing CUPS print queues As a system administrator, you"ll likely be asked to manage and manipulate printer more often. On Linux, the lp lp, lpq lpq, lpstat lpstat, lprm lprm, and lpadmin lpadmin commands are your tools. Other tools include commands are your tools. Other tools include lpoptions lpoptions, accept accept, reject reject, and cancel cancel.

Name lp Syntax lp[-E][-Uusername][-c][-ddestination[/instance]]

[-hhostname[:port]][-m]

[-nnum-copies][-ooption[=value]][-qpriority][-s][-tt.i.tle]

[-Hhandling][-Ppage-list][--][file(s)]

Description lp submits files for printing or alters a pending job. submits files for printing or alters a pending job.

Options -- Prints from standard input.

-d destination destination Prints files to the named printer.

-o "name=value [ [name=value ...]" ...]"

Sets one or more job options.

Example 1 Print a double-sided legal doc.u.ment to a printer called "foo": $lp-dfoo-omedia=legal-osides=two-sided-long-edgefilename Example 2 Print an image across four pages: $lp-dbar-oscaling=200filename Example 3 Print a text file with 12 characters per inch, 8 lines per inch, and a 1-inch left margin: lp-dbar-ocpi=12-olpi=8-opage-left=72filename

Name cancel Syntax cancel[-E][-Uusername][-a][-hhostname[:port]][-uusername][id]

[destination ][destination-id]

Description cancel removes the specified print jobs from the queue. removes the specified print jobs from the queue.

Options -a Cancels all jobs on the named destination, or all jobs on all destinations if no destination is provided.

Name lpstat Syntax lpstat[-E][-Uusername][-hhostname[:port]][-l][-Wwhich-jobs]

[-a[destination(s)]][-c[cla.s.s(es)]][-d]

© 2024 www.topnovel.cc