Mik*_*e B 3 linux centos xinetd
愚蠢的问题...我无法让 xinetd 在我的 Linux 机器(CENTOS 4.8)上启动。
我已经通过 yum 删除它并重新安装它。当我尝试启动、停止等时,我完全没有收到任何错误。
[root@server ~]# service xinetd stop
[root@server ~]# service xinetd start
[root@server ~]# service xinetd restart
Run Code Online (Sandbox Code Playgroud)
我希望从系统中看到一些标准状态(例如“服务已启动 - [确定]”我也没有在 /var/log/messages 中看到任何日志条目
我尝试使用 -d 选项运行 init 脚本,但没有。没有错误。没有服务启动的确认消息。没有什么。
有任何想法吗?
[更新] - 根据建议,这是 cat /etc/init.d/xinetd 的输出
#!/bin/bash
#
# xinetd This starts and stops xinetd.
#
# chkconfig: 345 56 50
# description: xinetd is a powerful replacement for inetd. \
# xinetd has access control mechanisms, extensive \
# logging capabilities, the ability to make services \
# available based on time, and can place \
# limits on the number of servers that can be started, \
# among other things.
#
# processname: /usr/sbin/xinetd
# config: /etc/sysconfig/network
# config: /etc/xinetd.conf
# pidfile: /var/run/xinetd.pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/init.d/functions
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
# More config
test -f /etc/sysconfig/xinetd && . /etc/sysconfig/xinetd
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Check that networking is up.
[ "${NETWORKING}" = "yes" ] || exit 0
[ -f /usr/sbin/xinetd ] || exit 1
[ -f /etc/xinetd.conf ] || exit 1
RETVAL=0
prog="xinetd"
start(){
echo -n $"Starting $prog: "
# Localization for xinetd is controlled in /etc/synconfig/xinetd
if [ -z "$XINETD_LANG" -o "$XINETD_LANG" = "none" -o "$XINETD_LANG" = "NONE" ]; then
unset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
else
LANG="$XINETD_LANG"
LC_TIME="$XINETD_LANG"
LC_ALL="$XINETD_LANG"
LC_MESSAGES="$XINETD_LANG"
LC_NUMERIC="$XINETD_LANG"
LC_MONETARY="$XINETD_LANG"
LC_COLLATE="$XINETD_LANG"
export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
fi
unset HOME MAIL USER USERNAME
daemon $prog -stayalive -pidfile /var/run/xinetd.pid "$EXTRAOPTIONS"
RETVAL=$?
echo
touch /var/lock/subsys/xinetd
return $RETVAL
}
stop(){
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
rm -f /var/lock/subsys/xinetd
return $RETVAL
}
reload(){
echo -n $"Reloading configuration: "
killproc $prog -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/xinetd ] && restart
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL
Run Code Online (Sandbox Code Playgroud)
小智 5
如果完全绕过启动脚本并使用调试标志 -d 直接运行 xinetd,您可能会获得一些有用的信息。
/usr/sbin/xinetd -f /etc/xinetd.conf -d
Run Code Online (Sandbox Code Playgroud)
在我的 Gentoo 盒子上,当我没有定义任何服务时,上面的命令将在下面的调试输出之后退出
09/10/26@21:26:05: DEBUG: 23117 {cnf_start_services} mask_max = 0, services_started = 0
09/10/26@21:26:05: CRITICAL: 23117 {init_services} no services. Exiting...
Run Code Online (Sandbox Code Playgroud)
启用服务后(在本例中为 chargen,在 /etc/xinetd.d/chargen-stream 中将行“disable = yes”更改为“disable = no”)运行上述命令会产生以下输出,并且 xinetd 不会退出直到按下 Ctrl-c。
09/10/26@21:41:00: DEBUG: 23261 {cnf_start_services} Started service: chargen-stream
09/10/26@21:41:00: DEBUG: 23261 {cnf_start_services} mask_max = 6, services_started = 1
09/10/26@21:41:00: NOTICE: 23261 {main} xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
09/10/26@21:41:00: NOTICE: 23261 {main} Started working: 1 available service
09/10/26@21:41:00: DEBUG: 23261 {main_loop} active_services = 1
Run Code Online (Sandbox Code Playgroud)
顺便说一句,如果您在启用 chargen 的情况下运行 init 脚本,那么您应该能够通过运行以下命令使用 netstat 来查看 xinetd 正在侦听 chargen 端口:
netstat -tap | grep xinetd
Run Code Online (Sandbox Code Playgroud)
输出应如下所示:
tcp 0 0 *:chargen *:* LISTEN 23439/xinetd
Run Code Online (Sandbox Code Playgroud)