#!/bin/sh
#
# xfs:       Starts the X Font Server
#
# Version:      @(#) /etc/rc.d/init.d/xfs 1.4
#
# chkconfig: 2345 90 10
# description: Starts and stops the X Font Server at boot time and shutdown.
#
# processname: xfs
# config: /etc/X11/fs/config
# hide: true

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

reload() {
    if [ -f /var/lock/subsys/xfs ]; then
	echo -n "Neuladen der X Schriften-Server Konfiguration: "
	killproc xfs -USR1
	RETVAL=$?
	echo
    fi
}

start() {
    echo -n "Starte X Schriften-Server: "
    rm -fr /tmp/.font-unix
    daemon xfs -port -1 -daemon -user xfs
    RETVAL=$?
    touch /var/lock/subsys/xfs
    echo
}

stop() {
    echo -n "Beende X Schriften-Server: "
    killproc xfs
    RETVAL=$?
    rm -f /var/lock/subsys/xfs
    echo
}

RETVAL=0

# See how we were called.
case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  status)
      status xfs
      ;;
  reload)
      reload
      ;;
  restart)
      if [ -f /var/lock/subsys/xfs ]; then
	  reload
      else
	  start
      fi
      ;;
  *)
	echo "*** Benutzung: xfs {start|stop|status|reload|restart}"
	exit 1
esac

exit $RETVAL
