I intend to run fetchmail from /etc/init.d/.
Just want to verify that I did not miss something important or do something 
wrong:

        1.
The script /etc/init.d/fetchmail is taken from /usr/share/doc/fetchamil/contrib
/debian_rc:

----------------------------------------------------------------

!/bin/sh
#
# To start fetchmail as a system service, copy this file to
# /etc/init.d/fetchmail and run "update-rc.d fetchmail
# defaults".  A fetchmailrc file containg hosts and
# passwords for all local users should be placed in /root
# and should contain a line of the form "set daemon <nnn>".
#
# To remove the service, delete /etc/init.d/fetchmail and run
# "update-rc.d fetchmail remove".

DAEMON=/usr/bin/fetchmail

set -e
test -f $DAEMON || exit 0

case "$1" in
  start)
        echo -n "Starting mail retrieval agent: "
        if start-stop-daemon --start --quiet --exec $DAEMON; then echo 
"fetchmail."
        else echo "fetchmail already running."; fi
        ;;
  stop)
        echo -n "Stopping mail retrieval agent: "
        start-stop-daemon --stop --quiet --exec $DAEMON
        echo "fetchmail."
        ;;
  force-reload|restart)
        echo -n "Restarting mail retrieval agent: "
        start-stop-daemon --stop --quiet --exec $DAEMON
        start-stop-daemon --start --quiet --exec $DAEMON
        echo "fetchmail."
        ;;
  *)
        echo "Usage: /etc/init.d/fetchmail {start|stop|restart}"
        exit 1
        ;;
esac

exit 0


----------------------------------------------------------------

Since the local mail service is started with S20, is it wise to call 
        update-rc.d fetchmail 
with priority 20? I mean, won't it cause unnecessary error messages at boot 
because fetchmail might look for the mail service when it is not started yet?
Isn't 
        update-rc.d fetchmail defaults 95-start 05-stop
better?

        2.
/root/.fetchmailrc will be:

----------------------------------------------------------------
# ~/.fetchmailrc

poll mail.israsrv.net.il protocol pop3 
        username shaulk, with password XXXXXXXXX, is shaul here;

set daemon 900
set syslog

----------------------------------------------------------------

Is it better to have the config file in /etc/fetchmailrc since /etc is the 
usual dir for config files?

Suppose I'll write the config file in /etc/fetchmailrc. How do I tell 
fetchmail to look it there? Will
        start-stop-daemon --stop --quiet --exec $DAEMON -- -f /etc/fetchmailrc
work?


        3.
Is it a good idea to ask the package maintainer to help running fetchmail in 
this way by installing no-fetchmail-on-boot file and an rc script when 
installing the package (like PPP does)?

Reply via email to