Blob Blame History Raw
#!/bin/sh
#
# xfs - Starts the X Font Server
#
# chkconfig: - 90 10
# description: Starts and stops the X Font Server at boot time and shutdown. \
#              It also takes care of (re-)generating font lists.

# http://fedoraproject.org/wiki/FCNewInit/Initscripts
### BEGIN INIT INFO
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts the X Font Server
# Description: Starts and stops the X Font Server at boot time and shutdown. \
#              It also takes care of (re-)generating font lists.
### END INIT INFO

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

# Set umask to ensure fonts.dir and similar files get created mode 0644
umask 133

FONT_UNIX_DIR=/tmp/.font-unix

exec="/usr/bin/xfs"
prog=${exec##*/}

lockfile=/var/lock/subsys/$prog

start() {
    echo -n $"Starting $prog: "
    # Make sure .font-unix dir, exists.
    if [ ! -d $FONT_UNIX_DIR ]; then
        mkdir -m 1777 $FONT_UNIX_DIR || :
    fi
    daemon $exec -droppriv -daemon
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc xfs
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status $prog
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
	;;
    reload)
        status $prog >/dev/null || exit 7
        killproc xfs -USR1
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|reload|restart|try-restart|force-reload}"
        exit 2
esac