⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unx34.htm

📁 Linux Unix揭密.高质量电子书籍.对学习Linux有大帮助,欢迎下载学习.
💻 HTM
📖 第 1 页 / 共 3 页
字号:

<P>The processes specific to state 3, file-sharing state, are started by the /etc/rc3 command. This command runs all scripts in the /etc/rc3.d directory that begin with the letter S. The file-sharing state was originally created to start the remote file 
sharing (RFS) application. RFS has since been overshadowed by its more popular counterpart network file system (NFS). So the /etc/rc3.d directory is usually empty unless you have purchased the NFS addon software.

<BR></P>

<P>When the system is operational, you will see the login screen or a console login prompt:

<BR></P>

<PRE>Console Login:</PRE>

<P>To get an idea of what's happening on a running UNIX system, the following list describes some of the processes that are running. (You can list the active processes by typing ps ef from the shell.)

<BR></P>

<UL>

<LI>init&#151;This runs, waiting for changes to the run state that you request with the init or telinit commands.

<BR>

<BR></LI>

<LI>sac&#151;This manages the port monitors on your system. Port monitors are processes that listen to ports for login requests or other networking requests.

<BR>

<BR></LI>

<LI>mousemgr&#151;This handles your mouse activities.

<BR>

<BR></LI>

<LI>in.routed&#151;This manages your TCP/IP routing tables, keeping your system uptodate with routes to other systems on the Internet.

<BR>

<BR></LI>

<LI>nfs*&#151;The NFS software starts up a bunch of processes that run, waiting for requests relating to sharing NFS resources.

<BR>

<BR></LI>

<LI>cron&#151;This checks spool directories for commands that were set up to run later. It then starts those commands when they are scheduled to run.

<BR>

<BR></LI>

<LI>lpNet&#151;This handles remote printing requests between your system and other UNIX systems.

<BR>

<BR></LI>

<LI>lpsched&#151;This manages the printing queue for print requests on your system.

<BR>

<BR></LI></UL>

<P>If you have logged and started up the graphical interface, you will see other processes as well. For example, the X process is the X windowing system server, and Desktop Manager (dtm) manages the windows and icons on your desktop.

<BR></P>

<H3 ALIGN="CENTER">

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

<FONT SIZE=4><B>Booting Multiple Operating Systems (Intel)</B>

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

<P>If you are running UNIX on a PC, it is possible to have several different operating systems installed on different partitions of your hard disk.

<BR></P>

<P>When you install UnixWare, you are allowed to create several partitions and are asked which partitions you want to use for UnixWare and which you want to use for other operating systems. Other operating systems can be DOS, OS/2, or NT. Once you have 
partitioned the disk and installed the operating systems, you can manage which system you boot from (that is, which is the active partition) with the fdisk utility.

<BR></P>

<P>Versions of the fdisk command are available in DOS, UNIX, and other operating systems. To run fdisk, open a shell, type su (followed by the root password, when requested), and type /usr/sbin/fdisk. You'll see the following:

<BR></P>

<PRE>             Total disk size is 683 cylinders (202.8 MB)

                                Cylinders            Approx

Partition  Status     Type    Start  End Length  %     MB\

    [ic:cc]=========  ====== =========== =====  === ====== ===  ======

    1             pre5.0DOS     0   101   102   15   30.3

    2      Active UNIX System  103   681   579   85   171.9

SELECT ONE OF THE FOLLOWING:

     0.   Overwrite system master boot code

     1.   Create a partition

     2.   Change Active (Boot from) partition

     3.   Delete a partition

     4.   Update (Update disk configuration and exit)

     5.   Exit (Exit without updating disk configuration)

Enter Selection:</PRE>

<P>This example shows the partitions for two operating systems (DOS and UnixWare) on a 202.8 MB hard disk. UNIX is the active operating system and consumes 85 percent of the hard disk (171.9 MB). DOS is on the first partition, consuming 15 percent, or 30.3 

MB, of the hard disk.

<BR></P>

<P>To change the active partition from UNIX to DOS in the example, enter 2, then 1, then 4. The next time you reboot your system, DOS will start.

<BR></P>

<H3 ALIGN="CENTER">

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

<FONT SIZE=4><B>Understanding System States</B>

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

<P>The early UNIX systems ran on minicomputers and mainframes. The concept of system states grew from the need to have different levels of activity occurring on the system, depending on whether the system was in full use, undergoing system maintenance, or 

transitioning between those states.

<BR></P>

<P>An administrator could start up a large computing system in single-user mode, with no networking running or terminals logged in (other than the console terminal). In this way, the administrator could debug any problems with the system before being 
bombarded with requests from the outside world.

<BR></P>

<P>Over the years, some system states have become outdated. If you're the only UNIX user on a PC, you will rarely need to use any system states other than those that bring the system up and bring it down.

<BR></P>

<P>The following list describes the UNIX system states:

<BR></P>

<UL>

<LI>0&#151;This is the shutdown state. When you change to state 0, all processes, including the UNIX system itself, are stopped.

<BR>

<BR></LI>

<LI>1 (s or S)&#151;This is the single-user state. Actually, there are three states to change to that are single-user states: 1, s, and S. Put the system in single-user state if you want to keep other users off the system while you do administrative tasks. 

Differences between 1, s, and S are as follows:

<BR>

<BR>1&#151;All file systems are mounted, all networking is turned off, all terminal processes are turned off (so no other users can log in).

<BR>

<BR>s or S&#151;This is the state the system enters if there is no /etc/inittab file. If you change to this state, your terminal becomes the system console, other terminals are logged off, and all file systems remain mounted. When the system comes up in 
this state, only the following file systems are mounted: /, /var, /stand, /proc, and /dev/fd.

<BR>

<BR></LI>

<LI>2&#151;This is the multiuser state. Actually, this state starts all scripts in the /etc/rc2.d directory, which includes networking as well as multiuser processes such as those that allow other users to log in. So, even if you are the only person using 

your system, you need to come up in a multiuser state (2 or 3) to run networking effectively. (In fact, the graphical user interface won't even run in singleuser state.)

<BR>

<BR></LI>

<LI>3&#151;This is the remote file-sharing state. If NFS is installed, your system automatically advertises local file systems and mounts remote file systems associated with NFS. The reason there is a whole state for file sharing is that one of the 
developers at AT&amp;T who was given the job of doing the startup scripts for RFS rewrote the entire way changing system states was done and added the RFS state. This method is still used today (as described in this chapter).

<BR>

<BR></LI>

<LI>6&#151;This is the reboot state. When you change to init 6, the system shuts down and starts back up.

<BR>

<BR></LI></UL>

<P>Other initialization states include the following:

<BR></P>

<UL>

<LI>4&#151;An alternate system state. You can add your own state 4 entries to the /etc/inittab file to create your own run state.

<BR>

<BR></LI>

<LI>5&#151;This is the firmware state. On a PC, this simply does a shutdown and reboot (the same as state 6). Historically, firmware mode was used on the old AT&amp;T 3B2 computers to enter firmware mode to do hardware maintenance tasks.

<BR>

<BR></LI>

<LI>a, b, or c&#151;These are states you can define if you want to start additional processes. These states just start commands without changing the run level.

<BR>

<BR></LI>

<LI>Q or q&#151;These options simply tell init to reread the /etc/inittab file. Use this if you have made changes to the /etc/inittab file and you want new commands run for the current run level.

<BR>

<BR></LI></UL>

<P>You can set initdefault to run levels 1, s, S, 2, or 3. You will almost always set the run level to level 2 or 3 on a small system. Other states are states that you change to on a running system. To change system states, you can use the init command.

<BR></P>

<H3 ALIGN="CENTER">

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

<FONT SIZE=4><B>Understanding the Initialization Table (</B><B><I>inittab</I></B><B>)</B>

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

<P>The /etc/inittab file contains the processes that are started when init brings up the system or changes to another state. Some of the entries in inittab are daemons (processes that run continuously in the background) and others, such as the /etc/rc2 
entry, are used to start up other processes for particular run states.

<BR></P>

<P>Each entry in the inittab file consists of the following fouritem, colonseparated field:

<BR></P>

<PRE>idtag:runstate:action:process</PRE>

<P>The <I>idtag</I> is any tag (from one to four characters) that identifies the entry. The <I>runstate</I> is the system state in which this entry should be run. You can have several system states assigned to an entry.

<BR></P>

<P>The <I>action</I> is a keyword that corresponds to one of the following: respawn (if the process goes away, start it again), wait (wait for the process to finish before continuing to the next process), once (run the process once, wait for it to finish, 

then don't start it again), boot (run the process the first time you go into a multiuser state, without waiting for it to finish), bootwait (run the process the first time you go into a multiuser state, waiting for it to finish before proceeding), and 
sysinit (run the process when the system first comes up). There is one initdefault action in the inittab file to indicate the state that the system starts in.

<BR></P>

<P>The <I>process</I> is the command that is actually run when the criteria in the first two fields are met (that is, the correct <I>runstate</I> and <I>action</I>).

<BR></P>

<P>The following is an example of an inittab entry:

<BR></P>

<PRE>co:12345:respawn:ttymon g v p &quot;Console Login: &quot; d \

     [cc]/dev/console l console</PRE>

<P>Here the entry is tagged co. The entry is run in system states 1, 2, 3, 4, and 5. If the process dies, it is started again (respawn). The actual process runs in the ttymon command (terminal monitor), which gives you the ability to log in from the system 

console.

<BR></P>

<H3 ALIGN="CENTER">

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

<FONT SIZE=4><B>Understanding Run State Directories (</B><B><I>rc?.d</I></B><B>)</B>

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

<P>Applications that have daemon processes (that is, processes that must run continuously for the application to process properly), or that require that something be initialized when the system starts, often have scripts in a run state directory to do 
these functions. There are different directories for each of the run states you could change to.

<BR></P>

<P>The following is a list of the run state directories:

<BR></P>

<UL>

<LI>/etc/rc0.d&#151;Contains startup scripts relating to the shutdown (0) and reboot (5 and 6) run states.

<BR>

<BR></LI>

<LI>/etc/rc1.d&#151;Contains startup scripts relating to the single-user (1, s, and S) run states.

<BR>

<BR></LI>

<LI>/etc/rc2.d&#151;Contains startup scripts related to multiuser (2 and 3) run states.

<BR>

<BR></LI>

⌨️ 快捷键说明

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