在/etc/services插入:
mydaytime 49999/tcp # 我的mydaytime
在/etc/xinetd.d/目录中,创建一个mydaytime文件:
service mydaytime
{
disable = no
port = 49999
socket_type = stream
protocol = tcp
user = lvy
server = /tmp/daytime
server_args =daytime
wait = no
}
当然你的服务程序应该在/tmp/目录下面,名字为daytime,
随便一个helloworld程序就行了。
最后重启xinetd服务:
service xinetd restart
或者
systemctl restart xinetd
测试:
telnet localhost mydaytime
如果有日志文件,到/var/log/messages查看
(当然系统不一样,去/etc/rsyslog.d/查看相应的配置文件)