File cachefilesd.init of Package cachefilesd

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:       cachefilesd
# Required-Start: $remote_fs $syslog
# Required-Stop:  $remote_fs $syslog
# Default-Start:  3 5
# Default-Stop:
# Description:    cache files daemon used by remote fs like NFS
### END INIT INFO

. /etc/rc.status

OPTIONS=""
RETVAL=0
PIDFILE=/var/run/cachefilesd.pid
MODPROBE=/sbin/modprobe
MODPROBE_ARGS=""
PROG="cachefilesd"
PROG_BIN=/sbin/$PROG

[ ! -x $PROG_BIN ] && exit 0

# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/$PROG ] && . /etc/sysconfig/$PROG

case "$1" in 
  start)
	echo -n $"Starting $PROG: "

	# Load the cachefiles module if needed
	[ -x "$MODPROBE" ] && {
		if ! /sbin/lsmod | grep cachefiles > /dev/null ; then
			 $MODPROBE cachefiles $MODPROBE_ARGS || exit 1
		fi
	}

	startproc -p $PIDFILE $PROG_BIN ${OPTIONS}
	rc_status -v
	;;
  stop)
	echo -n $"Shutting down $PROG: "
	killproc -p $PIDFILE $PROG_BIN
	rc_status -v
	;;
  status)
	echo -n "Checking for $PROG: "
	checkproc $PROG_BIN
	rc_status -v
	;;
  restart|reload)
	$0 stop
	$0 start
	rc_status
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|status}"
	exit 1
esac

rc_exit