Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > cbf0187f2b34d88774808dc8114c0173 > files > 1

xinetd-2.3.3-4mdk.i586.rpm

#!/bin/bash
#
# xinetd        This starts and stops xinetd.
#
# chkconfig: 345 56 50
# description: xinetd is a powerful replacement for inetd. \
#	       xinetd has access control machanisms, 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

prog="xinetd"
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 networking is up.
[ -z "$NETWORKING" -o "$NETWORKING" = "no" ] && exit 0

if [ ! -e /usr/sbin/xinetd ];then
    if [[ -x /usr/sbin/update-alternatives ]];then
	/usr/sbin/update-alternatives --auto xinetd
    fi
    [[ -e /usr/sbin/xinetd ]] || { echo "/usr/sbin/xinetd doen't exist";exit 1 ;}
fi

[ -f /etc/xinetd.conf ] || exit 1
RETVAL=0

start(){
    echo -n $"Starting $prog: "
    # Need to get rid of localization for external services - 
    # it doesn't make much sense to have i18n on the server side here

    LANG=en_US
    LC_TIME=en_US
    LC_ALL=en_US
    LC_MESSAGES=en_US
    LC_NUMERIC=en_US
    LC_MONETARY=en_US
    LC_COLLATE=en_US
    export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
    unset HOME MAIL USER USERNAME
    daemon xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid "$EXTRAOPTIONS"
    RETVAL=$?
    echo
    touch /var/lock/subsys/xinetd
    return $RETVAL
}

stop(){
    echo -n $"Stopping $prog: "
    killproc xinetd
    RETVAL=$?
    echo
    rm -f /var/lock/subsys/xinetd
    return $RETVAL

}

reload(){
    echo -n $"Reloading configuration: "	
    killproc xinetd -USR2
    RETVAL=$?
    echo
    return $RETVAL
}

restart(){
    stop
    start
}

condrestart(){
    [ -z "$DURING_INSTALL" ] && [ -e /var/lock/subsys/xinetd ] && restart
    return 0
}


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

exit $RETVAL