HAProxy -> xinetd -> mysql-check脚本,HAProxy 便取得了mysql的状态信息yum install xinetd#!/bin/bashecho `uptime | egrep -o "up ([0-9]+) days" | awk "{print $2}"`这个脚本用来输出当前服务器的在线天数chmod +x 给脚本添加可执行权限helloworld,文件名 /etc/xinetd.d/helloworld,内容为service helloworld{disable = noport= 9200socket_type = streamprotocol= tcpwait= nouser= rootserver = /root/test.shserver_args = test}port 指定监听的端口server 指定要执行的脚本/etc/serviceshelloworld 服务helloworld 9200/tcp#wap-wsp 9200/tcp#wap-wsp 9200/udp(4)重启 xinetd
systemctl restart xinetd.service(5)测试
nc 和 telnet 两个命令测试一下nc localhost 9200

telnet localhost 9200

可以正确输出脚本执行内容,完成示例
总结
Linux shell实现HTTP服务的内容到这就基本结束了,希望对大家的工作和学习能有所帮助,如果有疑问可以留言讨论。