Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > 12825ba13850909f8a3fb5ce5643966a > files > 2

fetchmail-daemon-6.1.0-1.1mdk.i586.rpm

#!/bin/sh
#
# chkconfig: 345 91 35
# description:	Starts and stops the fetchmail daemon used to retrive mail \
#		via various protocols (such as POP3 and IMAP4).
#
# config:	/etc/fetchmailrc

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that fetchmailrc exists.
[ -s /etc/fetchmailrc ] || exit 0


RETVAL=0

# See how we were called.
case "$1" in
  start)
	if [ ! -f /var/lock/subsys/fetchmail ]; then
		echo -n "Starting Fetchmail services: "
		daemon fetchmail -d 180 -f /etc/fetchmailrc 	
		RETVAL=$?
		echo
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
	else
		RETVAL=1
	fi
        ;;
  stop)
	if [ -f /var/lock/subsys/fetchmail ]; then
#		killproc fetchmail
		action "Shutting Fetchmail services: " /usr/bin/fetchmail --quit
		rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
		RETVAL=$?
	else
		RETVAL=1
	fi	
        ;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  reload)
	if [ -f /var/lock/subsys/fetchmail ]; then
       	echo -n "Reloading fetchmailrc file: "
		killproc fetchmail -HUP
		RETVAL=$?
		echo
	else
		RETVAL=1
	fi
	;;
  status)
	status fetchmail
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 1
esac

exit $RETVAL