#!/bin/bash
#
#	/etc/rc.d/init.d/pxe
#
# Starts the pxe daemon
#
# chkconfig: - 56 54
# description:  A Preboot Execution Environment (PXE) Server.  This \
# server will allow you to network boot other PXE based machines.
# processname: pxe

# Source function library.
. /etc/rc.d/init.d/functions

test -x /usr/sbin/pxe || exit 0

RETVAL=0

#
#	See how we were called.
#
case "$1" in
  start)
	# Check if pxe is already running
	if [ ! -f /var/lock/subsys/pxe ]; then
	    echo -n 'Starting pxe daemon: '
	    daemon /usr/sbin/pxe
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pxe
	    echo
	fi
	;;
  stop)
	echo -n 'Stopping pxe daemon: '
	killproc /usr/sbin/pxe
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pxe
	echo
	;;
  reload|restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  status)
	status /usr/sbin/pxe
	RETVAL=$?
	;;
  *)
	echo "Usage: /etc/rc.d/init.d/pxe {start|stop|restart|reload|status}"
	exit 1
esac

exit $RETVAL
