Definition: In Unix and other computer multitasking operating systems, a daemon is a computer program that runs in the background, rather than under the direct control of a user; they are usually initiated as background processes.
守护进程一般以“d“作为结尾,分为系统服务守护进程和网络服务守护进程。守护进程都由init脚本进行管理,可以在/etc/init.d/下查看到当前系统所有的守护进程。这里主要讨论下网络服务守护进程。
网络守护进程采用两种方式来运行,stand-alone和xinetd方式。
1)stand-alone
stand-alone是Unix传统的C/S模式,服务器侦听到本端口的请求,服务器创建一个子进程去响应这个请求,而主服务器继续监听后续请求。
2)xinetd
xinetd也成为Internet-super-server,相对于stand-alone,xinetd能够同时监听多个端口的请求,根据不同端口,启动相应的服务程序来响应相应的请求。
根据对以上两种服务类型的解释,他们各自的特点也非常明显,stand-alone适合大访问量的服务,xinetd适合小访问量的服务。
配置xinetd服务
在/etc/xinetd.d/目录下新增服务,拿我刚配置的svn服务举例,首先SVN没有太大的,类似于apache这样的访问量,所有采用xinetd的方式比较合适,配置参数很简单,就不一一解释了:
service svn
{
socket_type = stream
protocol = tcp
user = svn
wait = no
server = /usr/bin/svnserve
server_args = -i -r /opt/PDCP
}