Blame | Last modification | View Log | RSS feed
#!/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 INFOPATH=/sbin:/bin:/usr/bin:/usr/sbin# Source function library.. /etc/init.d/functions# Get config.test -f /etc/sysconfig/network && . /etc/sysconfig/network# More configtest -f /etc/sysconfig/xinetd && . /etc/sysconfig/xinetdRETVAL=0prog="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 4echo -n $"Starting $prog: "# Localization for xinetd is controlled in /etc/synconfig/xinetdif [ -z "$XINETD_LANG" -o "$XINETD_LANG" = "none" -o "$XINETD_LANG" = "NONE" ]; thenunset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATEelseLANG="$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_COLLATEfiunset HOME MAIL USER USERNAMEdaemon $prog -stayalive -pidfile /var/run/xinetd.pid "$EXTRAOPTIONS"RETVAL=$?echo[ $RETVAL -eq 0 ] && touch /var/lock/subsys/xinetdreturn $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 4echo -n $"Stopping $prog: "killproc -p /var/run/xinetd.pid $progRETVAL=$?echo[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xinetdreturn $RETVAL}reload(){[ -f /usr/sbin/xinetd ] || exit 5[ -f /etc/xinetd.conf ] || exit 6echo -n $"Reloading configuration: "killproc $prog -HUPRETVAL=$?echoreturn $RETVAL}restart(){stopstart}condrestart(){if [ -e /var/lock/subsys/xinetd ] ; thenrestartRETVAL=$?return $RETVALfiRETVAL=0return $RETVAL}# See how we were called.case "$1" instart)startRETVAL=$?;;stop)stopRETVAL=$?;;status)status $progRETVAL=$?;;restart)restartRETVAL=$?;;reload|force-reload)reloadRETVAL=$?;;condrestart|try-restart)condrestartRETVAL=$?;;*)echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"RETVAL=2esacexit $RETVAL