Fetchmail question
James Wilkinson
james at westexe.demon.co.uk
Mon Feb 21 17:58:20 UTC 2005
Sasa Stupar wrote:
> Running mail server on FC3 - sendmail+cyrus. Some user want to fetch mail
> from other servers so I have provided then fetchmail functionality. The
> question is how to run fetchmail as a daemon for all users at server
> startup?
> For now every user is responsible to run fetchmail -d xxx manually but if
> server went down for some reason then they need again manually to start it
Do I understand that you want to run fetchmail as a service? Put the
attached script under /etc/init.d, copy the .fetchmailrc to
/etc/fetchmailrc, run "chkconfig --add fetchmail", and turn it on
however you normally turn on services.
Hope this helps,
James.
--
James Wilkinson | Remember, half-measures can be very effective if
Exeter Devon UK | all you deal with are half-wits.
E-mail address: james |
@westexe.demon.co.uk |
-------------- next part --------------
#!/bin/bash
#
# Simple fetchmail start/stop script that fits in with Red Hat's System V
# system
# These two lines allow the ntsysv stuff to work...
# chkconfig: 345 87 13
# description: ESR's fetchmail program to check for new mail every few minutes.
# processname: fetchmail
# source function library
. /etc/init.d/functions
INTERVAL=500 # seconds
RETVAL=0
start() {
echo -n $"Starting fetchmail: "
daemon fetchmail -d $INTERVAL --fetchmailrc /etc/fetchmailrc
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
}
stop() {
echo -n $"Shutting down fetchmail: "
killproc fetchmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fetchmail
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/fetchmail ]; then
stop
start
RETVAL=$?
fi
;;
status)
status fetchmail
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
More information about the fedora-list
mailing list