How to start xinetd after server reboot

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Shawn L
Posts: 14
Joined: Wed Mar 23, 2016 3:42 pm

How to start xinetd after server reboot

Post by Shawn L »

Hi,

One of our servers was rebooted yesterday, but somehow the xinetd was not start after reboot. What can I do to make it automatically start each time after server reboot? Thanks in advance.

Here is the output of chkconfig:

Code: Select all

...
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
...
xinetd based services:
        chargen-dgram:  off
        chargen-stream: off
        daytime-dgram:  off
        daytime-stream: off
        discard-dgram:  off
        discard-stream: off
        echo-dgram:     off
        echo-stream:    off
        nrpe:           on
        rsync:          off
        tcpmux-server:  off
        time-dgram:     off
        time-stream:    off
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: How to start xinetd after server reboot

Post by bwallace »

I think you're ok actually. Here is the output of chkconfig from a test machine here that's been running for
uptime 12:44:34 up 16 days

Code: Select all

xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off

xinetd based services:
        chargen-dgram:  off
        chargen-stream: off
        daytime-dgram:  off
        daytime-stream: off
        discard-dgram:  off
        discard-stream: off
        echo-dgram:     off
        echo-stream:    off
        nrpe:           on
        nsca:           on
        tcpmux-server:  off
        time-dgram:     off
        time-stream:    off
Be sure to check out the Knowledgebase for helpful articles and solutions!
Shawn L
Posts: 14
Joined: Wed Mar 23, 2016 3:42 pm

Re: How to start xinetd after server reboot

Post by Shawn L »

But, in fact, the xinetd was not started after reboot. Do you have any idea what could cause this problem? This morning, another server was rebooted, and xinetd was not running on that server.

Code: Select all

[root@server ~]# service xinetd status
xinetd dead but pid file exists
[root@server ~]# service xinetd restart
Stopping xinetd:                                           [FAILED]
Starting xinetd:                                           [  OK  ]
[root@server~]# service xinetd status
xinetd (pid  29095) is running...
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to start xinetd after server reboot

Post by hsmith »

Which distro?
Former Nagios Employee.
me.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How to start xinetd after server reboot

Post by lmiltchev »

Do you find any clues in the /var/log/messages?

Run the following commands and show the output in code wraps:

Code: Select all

echo $PATH
cat /etc/init.d/xinetd
Be sure to check out our Knowledgebase for helpful articles and solutions!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: How to start xinetd after server reboot

Post by gormank »

If the pid file existed after a restart, the service died unexpectedly. Since the file existed, the service didn't restart.
The question is not how to make it start, but why didn't it shut down correctly. We could also ask why a starting service doesn't check the pid and verify that a matching process exists, but that's the next step.
Shawn L
Posts: 14
Joined: Wed Mar 23, 2016 3:42 pm

Re: How to start xinetd after server reboot

Post by Shawn L »

The dsitro is RHEL 6.6.

In the message file, I saw lots of kernel IO errors. Could that be the problem?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How to start xinetd after server reboot

Post by rkennedy »

Is your VM running off a SAN or NAS? This could be an issue. Please post the output @lmiltchev mentioned -

Code: Select all

echo $PATH
cat /etc/init.d/xinetd
Yes, IO errors can be fatal. Do you know why the machine was shutdown as @gormank mentioned?
Former Nagios Employee
Shawn L
Posts: 14
Joined: Wed Mar 23, 2016 3:42 pm

Re: How to start xinetd after server reboot

Post by Shawn L »

Code: Select all


[root@server~]# $PATH
-bash: /usr/lib64/qt-3.3/bin:/opt/jdk_jboss/bin:/opt/jdk_jboss/jre/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/var/cfengine/bin:/root/bin: No such file or directory

[root@server~]# 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


### BEGIN INIT INFO
# Provides:
# Required-Start: $network
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: start and stop xinetd
# 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.
### END INIT INFO

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

RETVAL=0

prog="xinetd"

start(){
    [ -f /usr/sbin/xinetd ] || exit 5
    [ -f /etc/xinetd.conf ] || exit 6
    # this is suitable way considering SELinux is guarding write
    # access to PID file
        [ $EUID -eq 0 ] || exit 4

    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
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xinetd
    return $RETVAL
}

stop(){
    [ -f /usr/sbin/xinetd ] || exit 5
    [ -f /etc/xinetd.conf ] || exit 6
    # this is suitable way considering SELinux is guarding write
    # access to PID file
        [ $EUID -eq 0 ] || exit 4

    echo -n $"Stopping $prog: "
    killproc -p /var/run/xinetd.pid $prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xinetd
    return $RETVAL

}

reload(){
    [ -f /usr/sbin/xinetd ] || exit 5
    [ -f /etc/xinetd.conf ] || exit 6

    echo -n $"Reloading configuration: "
    killproc $prog -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

restart(){
    stop
    start
}

condrestart(){
    if [ -e /var/lock/subsys/xinetd ] ; then
        restart
        RETVAL=$?
        return $RETVAL
    fi
    RETVAL=0
    return $RETVAL
}


# See how we were called.
case "$1" in
    start)
        start
        RETVAL=$?
        ;;
    stop)
        stop
        RETVAL=$?
        ;;
    status)
        status $prog
        RETVAL=$?
        ;;
    restart)
        restart
        RETVAL=$?
        ;;
    reload|force-reload)
        reload
        RETVAL=$?
        ;;
    condrestart|try-restart)
        condrestart
        RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        RETVAL=2
esac

exit $RETVAL
Shawn L
Posts: 14
Joined: Wed Mar 23, 2016 3:42 pm

Re: How to start xinetd after server reboot

Post by Shawn L »

I am not managing that server, I am not pretty sure why they rebooted it.
Locked