📄 init.8
字号:
.th INIT VIII 2/22/74.sh NAMEinit \*- process control initialization.sh SYNOPSIS.bd /etc/init.sh DESCRIPTION.it Initis invoked inside UNIX as the last step in the boot procedure.Generally its role is to create a process for eachtypewriter on which a user may log in..s3First,.it initchecksto see if the console switches contain 173030.(This number is likely to vary betweensystems.)If so, the console typewriter.bd /dev/tty8is opened for readingand writing and the Shell is invoked immediately.This feature is used to bring up a single-user system.When the system is brought up in this way, the.it gettyand.it loginroutines mentioned below and described elsewhere are not used.If the Shell terminates,.it initstarts over looking for theconsole switch setting..s3Otherwise, \fIinit\fRinvokes a Shell, with input taken from thefile.it /etc/rc.This command fileperforms housekeepinglike removing temporary files,mounting file systems, and startingdaemons..s3Then.it initreads the file.it /etc/ttysandforks several times to create a processfor each typewriter specified in the file.Each of these processes opens the appropriate typewriterfor reading and writing. These channels thusreceive file descriptors 0 and 1, the standard input andoutput.Opening the typewriter will usually involve a delay,since the \fIopen\fR is not completed until someoneis dialed up and carrier established on the channel.Then.it /etc/gettyis called with argument as specified by the last character ofthe.it ttysfile line..it Gettyreads the user's name and invokes.it login(q.v.)to log in the user and execute the Shell..s3Ultimately the Shell will terminatebecause of an end-of-file eithertyped explicitly or generated as a result of hanging up.The main path of \fIinit\fR, which has been waitingfor such an event,wakes up and removes the appropriate entry from thefile \fIutmp\fR, which records current users, andmakes an entry in \fI/usr/adm/wtmp\fR, which maintains a historyof logins and logouts.Then the appropriate typewriter is reopened and.it gettyisreinvoked..s3.it Initcatches the.it hangupsignal (signal #1) and interprets it to mean thattheswitches should be examined as in a reboot: if theyindicate a multi-user system, the.it /etc/ttysfile is read again.The Shell process on each line which used to be activein.it ttysbut is no longer there is terminated;a new process is created for each added line;lines unchanged in the file are undisturbed.Thus it is possible to drop or add phone lines withoutrebooting the system by changing the.it ttysfile and sending a.it hangupsignal to the.it initprocess: use ``kill \*-1 1.''.sh FILES/dev/tty?, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc.sh "SEE ALSO"login (I), kill (I), sh (I), ttys (V), getty (VIII)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -