Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > contrib-release-src > by-pkgid > d9257f5c3ffa0f094feff8b44fe95ce0 > files > 3

incron-0.5.8-1mdv2009.1.src.rpm

#! /bin/bash
#
# incron          Start/Stop the cron clock daemon.
#
# chkconfig: 2345 90 60
# description: incron is an "inotify cron" system. It works like the \
#              regular cron but is driven by filesystem events instead \
#              of time periods. It contains two programs, a daemon \
#              called "incrond" (analogous to crond) and a table \
#              manipulator "incrontab" (like "crontab").
# processname: incrond
# config: /etc/incrontab
# pidfile: /var/run/incrond.pid
#
### BEGIN INIT INFO
# Provides: incron
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Short-Description: An inotify cron based
# Description: incron is an "inotify cron" system. It works like the
#              regular cron but is driven by filesystem events instead
#              of time periods. It contains two programs, a daemon
#              called "incrond" (analogous to crond) and a table
#              manipulator "incrontab" (like "crontab").
### END INIT INFO

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

RETVAL=0

# See how we were called.
  
prog="incrond"

start() {
	gprintf "Starting %s: " "$prog"
	daemon incrond < /dev/null
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/incrond
	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc incrond
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/incrond
	return $RETVAL
}	

rhstatus() {
	status incrond
}	

restart() {
  	stop
	start
}	

reload() {
	gprintf "Reloading cron daemon configuration: "
	killproc incrond -HUP
	retval=$?
	echo
	return $RETVAL
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  status)
  	rhstatus
	;;
  condrestart)
  	[ -f /var/lock/subsys/incrond ] && restart || :
	;;
  *)
	gprintf "Usage: %s {start|stop|status|reload|restart|condrestart}\n" "$0"
	exit 1
esac

exit $?