我已经安装了xinetd,并编写了一个脚本:
#!/bin/bash
echo "Some text"
touch /home/somefile
我在下进行了服务配置,/etc/xinetd.d/
并且当我在配置的端口下连接到localhost时,基本上可以使用,因为:该文件somefile
由与服务连接时的touch命令生成。我用telnet连接:
telnet localhost someport
我不明白的是telnet不会输出字符串“ Some text”。我该怎么做才能使这项工作?
以下是/etc/xinetd.d/中的xinetd服务配置文件:
# This is the configuration for the tcp/stream echo service.
service my_service_name #not in /etc/services
{
# This is for quick on or off of the service
disable = no
# The next attributes are mandatory for all services
id = my_custom_id
type = UNLISTED
wait = yes
socket_type = stream
protocol = tcp
# External services must fill out the following
user = root
# group =
server = /usr/bin/program_name_here
# server_args =
# External services not listed in /etc/services must fill out the next one
port = 60001
}
更改wait
为no
可能会解决您的问题。从手册页:
如果其值为yes,则该服务为单线程;否则为0。这意味着xinetd将启动服务器,然后它将停止处理对服务的请求,直到服务器死掉并且服务器软件将接受连接。
关键在于,将wait设置为yes时,服务器软件应接受该连接,而脚本不会这样做。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句