#!/bin/bash # # Startup script for the xinetd server # # chkconfig: - 86 14 # description: xinetd # processname: xinetd # pidfile: /var/run/xinetd.pid # config: /etc/xinetd.conf # Source function library. . /etc/rc.d/init.d/functions xinetd=/usr/local/sbin/xinetd prog=xinetd RETVAL=0 start() { echo -n $"Starting $prog: " pidfile=/var/run/xinetd.pid pid=`cat $pidfile 2>/dev/null` [ "$pid" ] && \ [ "`find /proc/${pid}/exe -printf '%l%U\n' 2>/dev/null | awk -F'/' '{print $NF}'`" != "xinetd`id -u`" ] && \ /bin/rm -f $pidfile daemon $xinetd RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/xinetd return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $xinetd RETVAL=$? echo if [ $RETVAL = 0 ] ; then rm -f /var/lock/subsys/xinetd /var/run/xinetd.pid pid=`pidof -o $$ -o $PPID -o %PPID -x ${xinetd} || pidof -o $$ -o $PPID -o %PPID -x ${prog}` if [ "$pid" ] ; then killproc $xinetd RETVAL=$? fi fi } reload() { echo -n $"Reloading $prog: " killproc $xinetd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $xinetd RETVAL=$? ;; restart) stop start ;; condrestart) if [ -f /var/run/xinetd.pid ] ; then stop start fi ;; reload) reload ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}" exit 1 esac exit $RETVAL