slackbuilds_ponce/network/xinetd/rc.xinetd

106 lines
1.8 KiB
Text
Raw Normal View History

#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start(){
echo "Starting xinetd: /usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid "
# 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
# Make sure /var/lock/subsys exists
mkdir -p /var/lock/subsys
/usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/xinetd
return $RETVAL
}
stop(){
echo "Stopping xinetd... "
killall xinetd 2>/dev/null
RETVAL=$?
rm -f /var/lock/subsys/xinetd
return $RETVAL
}
restart(){
stop
sleep 1
start
}
reload(){
echo "Reloading xinetd configuration..."
killall -HUP xinetd 2>/dev/null
return $?
}
dump(){
echo -n $"Dumping configuration: "
killall -USR1 xinetd
RETVAL=$?
echo
return $RETVAL
}
check(){
echo $"Performing Consistency Check: "
/bin/kill -s IOT xinetd
RETVAL=$?
return $RETVAL
}
status(){
echo -n $"Checking xinetd: "
/bin/kill -s IOT xinetd 2>/dev/null
RETVAL=$?
if [ $RETVAL = 0 ]; then
echo "xinetd is running"
else
echo "xinetd is not running"
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
dump)
dump
;;
check)
check
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|dump|check|status}"
RETVAL=1
esac
exit $RETVAL