xinetd 中文man頁(yè)面
NAME
xinetd - 擴(kuò)展的互聯(lián)網(wǎng)服務(wù)守護(hù)進(jìn)程
總覽 SYNOPSIS
xinetd [options]
描述 DESCRIPTION
xinetd 執(zhí)行與 inetd 相同的任務(wù):它啟動(dòng)提供互聯(lián)網(wǎng)服務(wù)的程序。與在系統(tǒng)初始化時(shí)啟動(dòng)這些服務(wù)器,讓它們保持休眠,直到有連接請(qǐng)求到達(dá)才提供服務(wù)這種做法不同, fBxinetd 是唯一的被啟動(dòng)的守護(hù)進(jìn)程,它偵聽(tīng)各種服務(wù)在它們各自的配置文件中列出的所有端口。當(dāng)一個(gè)請(qǐng)求到達(dá),xinetd 啟動(dòng)合適的服務(wù)器。因?yàn)樗赃@種方式操作,xinetd (還有 inetd) 常被稱(chēng)作超級(jí)服務(wù)器。
列在 xinetd 的配置文件中的服務(wù)可以分為兩組。第一組的服務(wù)稱(chēng)為 多線程的 (multi-threaded) 并且它們需要為每個(gè)新的連接請(qǐng)求產(chǎn)生 (fork) 一個(gè)新的服務(wù)器進(jìn)程。接下來(lái)新的服務(wù)器將處理那個(gè)連接。對(duì)于這些服務(wù),xinetd 保持偵聽(tīng)新的請(qǐng)求從而可以孵化 (spawn) 新的服務(wù)器。另一方面,第二組包含著需要由服務(wù)器守護(hù)進(jìn)程處理所有新的連接請(qǐng)求的服務(wù)。這些服務(wù)稱(chēng)為 單線程的 (single-threaded) 并且 xinetd 將停止為它們處理新的請(qǐng)求,直到這個(gè)服務(wù)器退出。這個(gè)組中的服務(wù)一般都是基于數(shù)據(jù)報(bào)的。
至今,超級(jí)服務(wù)器存在的唯一理由是通過(guò)避免大量產(chǎn)生生命周期中大部分時(shí)間可能都是空閑著的進(jìn)程,從而節(jié)省系統(tǒng)資源。當(dāng)實(shí)現(xiàn)這種功能時(shí), fBxinetd 從超級(jí)服務(wù)器這種思想中獲得了好處,可以提供訪問(wèn)控制和日志等特性。更進(jìn)一步,xinetd 不僅限于偵聽(tīng) /etc/services 中列出的服務(wù)。因此,任何人都可以使用 xinetd 來(lái)啟動(dòng)特殊用途的服務(wù)器。
選項(xiàng) OPTIONS
- -d
- 啟用調(diào)試模式。這樣將產(chǎn)生大量調(diào)試輸出,并且使得在 xinetd 上使用一個(gè)調(diào)試器成為可能。
- -syslog syslog_facility
- 這個(gè)選項(xiàng)使得 syslog 使用指定的日志功能來(lái)記錄 xinetd 產(chǎn)生的消息??梢允褂孟铝泄δ埽?daemon, auth, user, local[0-7] (參見(jiàn) syslog.conf(5) 來(lái)查看它們的意義)。這個(gè)選項(xiàng)在 debug 模式是無(wú)效的,因?yàn)樗械南嚓P(guān)信息都將送到終端上。
- -filelog logfile
- xinetd 產(chǎn)生的信息將放到指定文件中。信息總是添加到文件之后。如果文件不存在,將會(huì)被創(chuàng)建。這個(gè)選項(xiàng)在 debug 模式無(wú)效,因?yàn)樗械南嚓P(guān)信息都將送到終端上。
- -f config_file
- 決定xinetd 用來(lái)配置的文件。默認(rèn)設(shè)置是 /etc/xinetd.conf。
- -pidfile pid_file
進(jìn)程 ID 被寫(xiě)入的文件。這個(gè)選項(xiàng)在 debug 模式無(wú)效。- -dontfork
- 指定xinetd 在前臺(tái)運(yùn)行,而不是分離自身以支持由 init 或 daemontools 運(yùn)行。這個(gè)選項(xiàng)自動(dòng)設(shè)置了 -stayalive (參見(jiàn)下面)。
- -stayalive
- 指定xinetd 保持運(yùn)行,即使沒(méi)有指定服務(wù)。
- -limit proc_limit
- 這個(gè)選項(xiàng)為 xinetd 可以啟動(dòng)的并行運(yùn)行的進(jìn)程數(shù)設(shè)置了一個(gè)上限。目的是防止進(jìn)程表溢出。
- -logprocs limit
- 這個(gè)選項(xiàng)為服務(wù)遠(yuǎn)程用戶(hù)的并行運(yùn)行的進(jìn)程數(shù)設(shè)置了一個(gè)上限。
- -version
- 這個(gè)選項(xiàng)使得 xinetd 打印出它的版本信息。
- -inetd_compat
- 這個(gè)選項(xiàng)使得 xinetd 在標(biāo)準(zhǔn)的配置文件之外,附加地讀取/etc/inetd.conf。/etc/inetd.conf 的讀取是在讀取標(biāo)準(zhǔn)的配置文件之后。
- -cc interval
- 這個(gè)選項(xiàng)指定 xinetd 每 interval 秒對(duì)內(nèi)部狀態(tài)進(jìn)行一次定時(shí)的一致性檢查。
syslog 和 filelog 選項(xiàng)是互相獨(dú)立的。如果沒(méi)有指定任何一個(gè),默認(rèn)將使用 syslog 的 daemon 功能。你不應(yīng)將 xinetd 信息與和服務(wù)日志相關(guān)的信息相混淆。后者只有在配置文件中指定之后才會(huì)記錄。
控制 xinetd CONTROLLING XINETD
xinetd 收到一定的信號(hào)時(shí)會(huì)執(zhí)行一定的動(dòng)作。與特定信號(hào)相關(guān)聯(lián)的特定動(dòng)作可以通過(guò)修改 config.h 并且重新編譯來(lái)重新定義。
- SIGHUP
- 導(dǎo)致一個(gè)強(qiáng)制的重新配置,意味著 xinetd 重新讀取配置文件,停止不再有效的服務(wù)的服務(wù)器。在正在運(yùn)行的服務(wù)器上將刷新訪問(wèn)控制,檢查遠(yuǎn)程位置,訪問(wèn)時(shí)間和服務(wù)器實(shí)例。如果允許的服務(wù)器實(shí)例數(shù)減少了,一些隨機(jī)選取的服務(wù)器將會(huì)被殺掉來(lái)滿(mǎn)足限制; 這將在任何服務(wù)器停止之后發(fā)生,因?yàn)椴荒芡ㄟ^(guò)遠(yuǎn)程位置或訪問(wèn)時(shí)間的檢查(this will happen after any servers are terminated because of failing the remote location or access time checks)。還有,如果 INTERCEPT 標(biāo)志被清除后又重新設(shè)置,此服務(wù)的任何運(yùn)行中的服務(wù)器將被停止。這樣做的目的是保證在強(qiáng)制的重新配置之后,沒(méi)有那種接受從不遵循訪問(wèn)控制標(biāo)準(zhǔn)的地址發(fā)來(lái)的包的服務(wù)器在運(yùn)行。 SIGQUIT
- 導(dǎo)致程序退出。
- SIGTERM
- 在 xinetd 退出之前,停止所有運(yùn)行中的服務(wù)器。
- SIGUSR1
- 導(dǎo)致內(nèi)部狀態(tài)轉(zhuǎn)儲(chǔ) (默認(rèn)的轉(zhuǎn)儲(chǔ)文件是 /var/run/xinetd.dump;要改變文件名,修改 config.h 然后重新編譯。)
- SIGIOT
- 導(dǎo)致一個(gè)內(nèi)部一致性檢查來(lái)核對(duì)程序使用的數(shù)據(jù)結(jié)構(gòu)沒(méi)有崩潰。當(dāng)檢查結(jié)束時(shí), xinetd 將產(chǎn)生一個(gè)消息,報(bào)告測(cè)試是成功了還是失敗了。
重新配置的時(shí)候,日志文件被關(guān)閉又重新打開(kāi)。這樣做允許移除舊的日志文件。
文件 FILES
- /etc/xinetd.conf
- 默認(rèn)的配置文件
- /var/run/xinetd.dump
- 默認(rèn)的轉(zhuǎn)儲(chǔ)文件
參見(jiàn) SEE ALSO
inetd(8),
xinetd.conf(5),
xinetd.log(5)
http://cr.yp.to/daemontools.html
#p#
NAME
xinetd - the extended Internet services daemon
SYNOPSIS
xinetd [options]
DESCRIPTION
xinetd performs the same function as inetd: it starts programs that provide Internet services. Instead of having such servers started at system initialization time, and be dormant until a connection request arrives, xinetd is the only daemon process started and it listens on all service ports for the services listed in its configuration file. When a request comes in, xinetd starts the appropriate server. Because of the way it operates, xinetd (as well as inetd) is also referred to as a super-server.
The services listed in xinetd's configuration file can be separated into two groups. Services in the first group are called multi-threaded and they require the forking of a new server process for each new connection request. The new server then handles that connection. For such services, xinetd keeps listening for new requests so that it can spawn new servers. On the other hand, the second group includes services for which the service daemon is responsible for handling all new connection requests. Such services are called single-threaded and xinetd will stop handling new requests for them until the server dies. Services in this group are usually datagram-based.
So far, the only reason for the existence of a super-server was to conserve system resources by avoiding to fork a lot of processes which might be dormant for most of their lifetime. While fulfilling this function, xinetd takes advantage of the idea of a super-server to provide features such as access control and logging. Furthermore, xinetd is not limited to services listed in /etc/services. Therefore, anybody can use xinetd to start special-purpose servers.
OPTIONS
- -d
- Enables debug mode. This produces a lot of debugging output, and it makes it possible to use a debugger on xinetd.
- -syslog syslog_facility
- This option enables syslog logging of xinetd-produced messages using the specified syslog facility. The following facility names are supported: daemon, auth, user, local[0-7] (check syslog.conf(5) for their meanings). This option is ineffective in debug mode since all relevant messages are sent to the terminal.
- -filelog logfile
- xinetd-produced messages will be placed in the specified file. Messages are always appended to the file. If the file does not exist, it will be created. This option is ineffective in debug mode since all relevant messages are sent to the terminal.
- -f config_file
- Determines the file that xinetd uses for configuration. The default is /etc/xinetd.conf.
- -pidfile pid_file
The process ID is written to the file. This option is ineffective in debug mode.- -dontfork
- Tells xinetd to stay in the foreground rather than detaching itself, to support being run from init or daemontools. This option automatically sets -stayalive (see below).
- -stayalive
- Tells xinetd to stay running even if no services are specified.
- -limit proc_limit
- This option places a limit on the number of concurrently running processes that can be started by xinetd. Its purpose is to prevent process table overflows.
- -logprocs limit
- This option places a limit on the number of concurrently running servers for remote userid acquisition.
- -version
- This option causes xinetd to print out its version information.
- -inetd_compat
- This option causes xinetd to read /etc/inetd.conf in addition to the standard xinetd config files. /etc/inetd.conf is read after the standard xinetd config files.
- -cc interval
- This option instructs xinetd to perform periodic consistency checks on its internal state every interval seconds.
The syslog and filelog options are mutually exclusive. If none is specified, the default is syslog using the daemon facility. You should not confuse xinetd messages with messages related to service logging. The latter are logged only if this is specified via the configuration file.
CONTROLLING XINETD
xinetd performs certain actions when it receives certain signals. The actions associated with the specific signals can be redefined by editing config.h and recompiling.
- SIGHUP
- causes a hard reconfiguration, which means that xinetd re-reads the configuration file and terminates the servers for services that are no longer available. Access control is performed again on running servers by checking the remote location, access times and server instances. If the number of server instances is lowered, some arbitrarily picked servers will be killed to satisfy the limit; this will happen after any servers are terminated because of failing the remote location or access time checks. Also, if the INTERCEPT flag was clear and is set, any running servers for that service will be terminated; the purpose of this is to ensure that after a hard reconfiguration there will be no running servers that can accept packets from addresses that do not meet the access control criteria.
- SIGQUIT
- causes program termination.
- SIGTERM
- terminates all running servers before terminating xinetd.
- SIGUSR1
- causes an internal state dump (the default dump file is /var/run/xinetd.dump; to change the filename, edit config.h and recompile).
- SIGIOT
- causes an internal consistency check to verify that the data structures used by the program have not been corrupted. When the check is completed xinetd will generate a message that says if the check was successful or not.
On reconfiguration the log files are closed and reopened. This allows removal of old log files.
FILES
- /etc/xinetd.conf
- default configuration file
- /var/run/xinetd.dump
- default dump file
SEE ALSO
inetd(8),
xinetd.conf(5),
xinetd.log(5)
http://cr.yp.to/daemontools.html