#!/bin/sh
#
# xfs:       Starts/Stops the X Font Server
#
# chkconfig: 2345 44 10
# description: Starts and stops the X Font Server at boot time and shutdown.
#
# processname: xfs
# config: /etc/X11/fs/config

WITHOUT_RC_COMPAT=1

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

SourceIfNotEmpty /etc/sysconfig/xfs

LOCKFILE=/var/lock/subsys/xfs
PIDFILE=/var/run/xfs.pid
RETVAL=0

start()
{
	msg_starting $"X Font"
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce \
	    --expect-user xfs -- xfs $ARGS
	RETVAL=$?
	return $RETVAL
}

stop()
{
	msg_stopping $"X Font"
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce \
	    --expect-user xfs -- xfs
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

reload()
{
	msg_reloading $"X Font"
	stop_daemon --pidfile "$PIDFILE" --expect-user xfs -USR1 -- xfs
	RETVAL=$?
	return $RETVAL
} 

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    reload)
	reload
	;;
    restart)
	restart
	;;
    condstop)
	if [ -e "$LOCKFILE" ]; then
	    stop
	fi
	;;
    condrestart)
	if [ -e "$LOCKFILE" ]; then
	    restart
	fi
	;;
    condreload)
	if [ -e "$LOCKFILE" ]; then
	    reload
	fi
	;;
    status)
	status --pidfile "$PIDFILE" --expect-user xfs -- xfs
	RETVAL=$?
	;;
    *)
	msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
	RETVAL=1
esac

exit $RETVAL
