unx40.htm

来自「Unix Unleashed, Third Edition is written」· HTM 代码 · 共 1,873 行 · 第 1/5 页

HTM
1,873
字号

<CENTER><A ID="I1" NAME="I1">

<BR>

<FONT SIZE=5><A ID="I2" NAME="I2"></A><B>40 &#151; Device Administration</B>

<BR></FONT></A></CENTER></H1>

<H5 ALIGN="CENTER">

<CENTER><A ID="I3" NAME="I3">

<FONT SIZE=3><B>Device Administration</B>

<BR></FONT></A></CENTER></H5>

<P>Central to the system administrator's responsibilities is the provision to users of access to the distributed and shared resources belonging to their environment. Some of the resources are software (for example, applications, the file system, and so 
on), whereas others are hardware such as terminals, modems, printers, and so on. Other chapters will address the issues and concerns pertaining to the administration of software resources; this chapter addresses issues pertaining to the administration and 

management of hardware resources (that is, devices). Namely, you will be presented with the skills necessary to set up, configure, and maintain the performance of modems, terminals, printers, x terminals, and PCs.

<BR></P>

<P>For the purposes of terminal, modem, and printer setup UNIX comes with a very powerful and central access facility known as Service Access Facility (SAF). No treatment of device administration is complete without covering SAF. Neither is it possible for 

the system administrator to complete the aforementioned tasks successfully without a rigorous understanding of what SAF is all about, and the skillful use of its associated commands. This chapter starts by explaining SAF.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I4" NAME="I4">

<FONT SIZE=4><B>Understanding Service Access Facility (SAF)</B>

<BR></FONT></A></CENTER></H3>

<P>Prior to System V release 4 of UNIX, administrators were provided with different processes and interfaces, along with their associated tools, to manage different physical resources on the system. Local port access used to be administered and controlled 

by interfaces that are different from those needed to set up for network access, or those pertaining to printer setup and so on. Administrators were therefore confronted with the challenge of learning and mastering the many different skills and interfaces 

needed to get the job done. To alleviate this challenge, SAF was introduced with SVR4. SAF provides a commonly applicable interface for the purpose of comprehensive and uniform management of all system resources. Upon mastering the concepts and associated 

commands that SAF provides, the administrator will be able to install, configure, monitor, and maintain information relevant to the local and network access to physical port services in SAF database files.

<BR></P>

<P>SAF consists primarily of port services, port monitors, the service access controller (sac) process, and SAF Administrative Files and Commands

<BR></P>

<P>A description of each of these components will be provided. Then the SAF initialization process will be detailed.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I5" NAME="I5">

<FONT SIZE=3><B>Port Services</B>

<BR></FONT></A></CENTER></H4>

<P>SAF defines a hierarchy of port control processes, of which port service is the lowest and the most &quot;intimate&quot; to the actual physical services. A port service is defined as a process that controls and monitors access to applications and other 

services, through physical ports such as ttys and TCP/IP. A tty service may provide users with dial-in/dial-out capabilities, thus allowing them to utilize high-level applications such as uucp, cu, and login. A TCP/IP port-related service may be required 
to provide printing, rlogin, or nfs services across the network.

<BR></P>

<P>There is a one-to-one association between physical ports (the actual physical service) and port services (the controlling process). It is not possible, for example, for two ttys to share the same port service; neither is it possible for one tty port to 

be controlled by more than one port service.

<BR></P>

<P>Upon creation of a port service, the system administrator assigns it a service name, which is referred to as the service tag. Service tags are used to conveniently distinguish between the port services running on the system. Port services are supported 

and controlled by intermediate-level processes called port monitors, which are described next.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I6" NAME="I6">

<FONT SIZE=3><B>Port Monitors</B>

<BR></FONT></A></CENTER></H4>

<P>A port monitor is an intermediate level process that controls a set of related services. SAF currently recognizes two types of port monitors: ttymon and listen. However SAF is not limited to those two types. Vendors and system programmers are provided 
with a well-defined network programming interface, to enable them to write their own monitor types.

<BR></P>

<P>Port monitor type ttymon controls and monitors tty-related port services, thus replacing pre-SVR4 getty and uugetty programs. Although maintaining support to uugetty and getty processes in SVR4 for reasons of backward compatibility, ttymon is the 
preferred method of installing, configuring, and monitoring tty port services in SVR4. Port monitor type listen, on the other hand, takes advantage of TCP/IP communications protocols (see Chapter 37 for more on TCP/IP) to provide across-the-network 
services mentioned earlier, such as network printing and remote file-sharing capabilities. Both port monitor types will be comprehensively explained in the upcoming sections.

<BR></P>

<P>System administrators are allowed the flexibility to create as many port monitors of any type as they deem necessary. Upon creation of a port monitor, a so-called port monitor tag has to be assigned to it. As in the case of port services, port monitor 
tags are names that help in distinguishing between port monitors. They can be given convenient names that may describe the nature of the service they support. Being a mid-level process, port monitors themselves are invoked, controlled, and monitored by the 

service access controller (sac) process.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I7" NAME="I7">

<FONT SIZE=3><B>Service Access Controller</B>

<BR></FONT></A></CENTER></H4>

<P>The service access controller process is the highest in SAF hierarchy. There is only one sac per system. It invokes and controls all port monitors, irrespective of type, which have been created and configured by the system administrator. sac is a 
program that is spawned by init upon system startup when multiuser mode is entered. When SVR4 is installed, an entry supporting sac is automatically included in the /etc/inittab file. A depiction of how this entry should look is as follows:

<BR></P>

<PRE>sc:234:respawn:/usr/lib/saf/sac -t 300</PRE>

<P>Due to the -t 300 option, sac routinely checks port monitors every 300 seconds for services. In order to change it to any other different value, enter

<BR></P>

<PRE>#sacadm -t &lt;seconds&gt;</PRE>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> Do not be surprised, upon checking the /etc/inittab file, if you see entries pertaining to ttymon port monitor. There is no contradiction between what you see and what has already been explained. 
Simply put, SVR4 allows a so-called &quot;express mode&quot; invocation of ttymon by init. This particularly applies to the case of the console port. You will still be able, however, to create instances of ttymon that are controlled and administered by 
sac.

<BR></NOTE>

<HR ALIGN=CENTER>

<H3 ALIGN="CENTER">

<CENTER><A ID="I8" NAME="I8">

<FONT SIZE=4><B>SAF Administrative Commands and Files</B>

<BR></FONT></A></CENTER></H3>

<P>SAF distinguishes between sac-specific, port monitor-specific, and port service-specific administrative and configuration files as well as administrative commands. In this section, administrative and configuration files and SAF-related commands will be 

described. The emphasis will be on their nature and the job they do. Command syntax and utilization for the purposes of creating, configuring, or checking the status of port monitors and port services will be left until later sections where they'll be 
discussed at length in the context of tasks to accomplish.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I9" NAME="I9">

<FONT SIZE=3><B>Service Access Controller Specific Files and Commands</B>

<BR></FONT></A></CENTER></H4>

<P>Once brought up, sac fetches two files. Those files are as follows: 1) /etc/saf/_sactab, which is the administrative database that contains entries pertaining to port monitors defined by the system administrator, and 2) the /etc/saf/_sysconfig file, 
which is a sac-specific configuration file. Whereas sac uses the first file to identify the port monitors to invoke, it uses the second one in order to self-customize its own environment. Contents of /etc/saf/_sactab can be modified by the sacadm command, 

which is sac's administrative command. Using sacadm allows administrators to create port monitors, check their status, and enable or disable them as well as remove them. Also, each port monitor provides an administrative command that can be used with 
sacadm in command substitution mode. The listen port monitor administrative command is nlsadmin, whereas ttymon's is ttyadm.

<BR></P>

<P>/etc/saf/_sysconfig file, on the other hand, is a file that would be used by sac to specify the environment governing all the services controlled by it. The sac program, once started by init, reads and interprets this file prior to the invocation of any 

service defined by /etc/saf/_sactab. There can optionally be one _sysconfig file per system, and it can be edited using vi or any other UNIX editor.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I10" NAME="I10">

<FONT SIZE=3><B>Port Monitor Specific Files and Commands</B>

<BR></FONT></A></CENTER></H4>

<P>When a port monitor is created using sacadm, an /etc/saf/&lt;<I>pmtag</I>&gt; directory will be created where port-specific files are maintained. Of prime interest are 1) /etc/saf/&lt;<I>pmtag&gt;/_</I>pmtab, and 2) 
/etc/saf/&lt;<I>pmtag</I>&gt;/_config. If, for example, you create a port monitor, which you assign a tag called ttyserv, the directory called /etc/saf/ttyserv will be created in which the administrative file called /etc/saf/ttyserv/_config will be 
maintained. This file is similar to the /etc/saf/_sactab in its functionality, as it is used by the port monitor to determine and bring up the port services as defined by the system administrator. /etc/saf/<I>&lt;pmtag&gt;</I>/_pmtab is a one-per-port 
monitor file and is modified using the pmadm command whether creating, deleting, or modifying the status of any of the associated port services. The /etc/saf/<I>&lt;pmtag&gt;</I>/_config is an optional port monitor specific configuration file that can be 
created by the system administrator using vi. Commands in this file can add to, or override, those found in the system configuration file _sysconfig. Before starting a port monitor defined in /etc/saf/_sactab file, sac checks the port monitors' respective 

directory, described previously, for the _config file. If found, _config is read and interpreted by sac to customize the port monitor's environment, and then the port monitor is started.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I11" NAME="I11">

<FONT SIZE=3><B>Port Service-Specific Files and Commands</B>

<BR></FONT></A></CENTER></H4>

<P>Being at the bottom of the SAF hierarchy, port services have no administrative files associated with it. The system administrator, however, has the option to create a port service-specific configuration script named after the service tag and kept in the 

associated port monitor's directory. So if, for example, a port service was created under port monitor ttyserv and was given the service tag ttylogin1, then the port service configuration file is named ttylogin1 and is kept in the /etc/saf/ttyserv 
directory. The complete filename thus becomes /etc/saf/ttyserv/ttylogin1. This file is read and interpreted by the controlling port monitor before starting the port service. Configuration commands included in the file may override or add to those found in 

the _config port monitor's file or _sysconfig that are associated with this service.

<BR></P>

<P>Table 40.1 summarizes what has been discussed so far and provides you with a quick way to narrow down the files and commands associated with each SAF component.

<BR></P>

<UL>

<LH><B>Table 40.1. Administrative files and commands associated with each of </B><B>the SAF components.</B>

<BR></LH></UL>

<TABLE BORDER>

<TR>

<TD>

<P><I>Process </I><I>Filename</I>

<BR></P>

<TD>

<P><I>Invoked by </I><I>Admin Command</I>

<BR></P>

<TD>

<P><I>Admin Filename</I>

<BR></P>

<TD>

<P><I>config</I>

<BR></P>

<TR>

<TD>

<P>sac</P>

<TD>

<P>init</P>

<TD>

<P>/etc/saf/_sactab</P>

<TD>

<P>/etc/saf/</P>

<TR>

<TD>

<P><BR></P>

<TD>

<P><BR></P>

<TD>

<P><BR></P>

<TD>

<P>_sysconfig sacadm</P>

<TR>

<TD>

<P>port monitor</P>

<TD>

<P>sac pmadm</P>

<TD>

<P>/etc/saf/&lt;pmtag&gt;/_pmtab </P>

<TD>

<P>/etc/saf/&lt;pmtag&gt;/_config</P>

<TR>

<TD>

<P>port service</P>

<TD>

<P>port monitor</P>

<TD>

<P>optional</P>

<TD>

<P>pmadm</P></TABLE>

<H3 ALIGN="CENTER">

<CENTER><A ID="I12" NAME="I12">

<FONT SIZE=4><B>SAF Initialization Process</B>

<BR></FONT></A></CENTER></H3>

<P>Figure 40.1 shows a flow chart summarizing the SAF initialization process. Note how it all starts with init invoking sac after reading a sac-associated entry in the /etc/inittab file. Once sac is started, it proceeds as follows:

<BR></P>

<P>

<BR><B><A HREF="40unx01.gif">Figure 40.1. Flow chart illustration of SAF </B><B>initialization process.</A></B>

<BR></P>

<PRE>

<BR>sac checks for the /etc/saf/_sysconfig configuration file. If found, it reads the file in order to self-customize its environment. This environment is a global one that, unless otherwise modified or overridden, will govern all defined SAF services.



<BR>sac determines which port monitors to invoke by reading the /etc/saf/_sactab file. For each port monitor, sac checks for the associated /etc/saf/<I>&lt;pmtag&gt;</I>/_config file. If one exists, the sac process reads, interprets, and implements the 
contents and customizes the port monitor's environment, irrespective of any earlier associated settings defined in _sysconfig files. The port monitor is then invoked.



<BR>Once invoked, the port monitor determines which port services to start by reading its /etc/saf/<I>&lt;pmtag&gt;</I>/_pmtab file. Next, the port monitor checks for the optional /etc/saf/<I>&lt;pmtag&gt;</I>/&lt;svctag&gt; corresponding to each port 
service. If one exists, it is read and interpreted to customize the port service environment. The port service is then invoked.</PRE>

<P>After the initialization process is completed, sac continues to poll the port monitors at regular intervals as defined by the -t option in the corresponding entry in the /etc/inittab file. Port monitors failing to respond to this polling process prompt 

sac into respawning them.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I13" NAME="I13">

<FONT SIZE=4><B>SAF Administration and Management</B>

<BR></FONT></A></CENTER></H3>

<P>This section introduces some of the concepts and skills pertaining to SAF management and administration. Because those skills commonly apply to all types of port monitors and their associated port services, the discussion will focus on how to accomplish 

each of the following tasks described, with little emphasis on the nature of the service being rendered to the user. SAF management and administration is a two-level system: one level applies to port monitors, whereas the other applies to port services. 
This section is therefore presented in two parts.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?