Re: strange email behavior

From: Gordon Messmer (yinyang_at_eburg.com)
Date: 09/09/03

  • Next message: steffen.grunewald_at_aei.mpg.de: "Re: fstab not mounting, but command line mount works"
    To: redhat-list@redhat.com
    Date: Mon, 08 Sep 2003 23:25:51 -0700
    
    
    

    Marc Adler wrote:
    > Ok, just as soon as I sent the above message, I realized I also had a
    > startup script for fetchmail that might have something to do with it. I
    > su'ed into root status and sure enough there in root's mutt were all the
    > lost messages. So now the problem is, what's wrong with the startup
    > script?
    [snip init script]

    Since running fetchmail as root is such an unbelievably bad idea that I
    can't believe anyone suggested it, I'm reposting a script based on one
    originally posted by Colin Cyr in 1998. Consider using this instead of
    the init script that you've got.

    This init script has two advantages. First, it doesn't run as root, so
    you're less likely to have problems if someone finds an exploitable
    problem in fetchmail. Second, it allows users control over their own
    fetchmail process, so they can change the password in the fetchmailrc
    and restart the process if they need to.

    
    

    #!/bin/sh
    #
    # fetchmail This shell script takes care of starting and stopping
    # fetchmail.
    #
    # chkconfig: 345 81 31
    # description: Fetchmail is a Mail Transport Agent, which is the program \
    # that moves mail from one machine to another.
    # processname: fetchmail
    # config: ~/.fetchmailrc
    # pidfile: ~/.fetchmail.pid
    FETCHMAIL=/usr/bin/fetchmail

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

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

    [ -f ${FETCHMAIL} ] || exit 0

    # See how we were called.
    case "$1" in
      start)
            # Start daemons.
            echo -n "Starting fetchmail:"
            for userdata in `getent passwd | cut -d: -f1,6`; do
                username=`echo ${userdata} | cut -d: -f1`
                userdir="`echo ${userdata} | cut -d: -f2`/.fetchmailrc"
                if [ -f ${userdir} ]; then
                    su - ${username} -c "${FETCHMAIL} -d300 &> /dev/null"
                    echo -n " ${username}"
                fi
            done
            echo
            ;;
      stop)
            # Stop daemons.
            echo -n "Shutting down fetchmail:"
            for userdata in `getent passwd | cut -d: -f1,6`; do
                username=`echo ${userdata} | cut -d: -f1`
                userdir="`echo ${userdata} | cut -d: -f2`/.fetchmail.pid"
                if [ -f ${userdir} ]; then
                    su - ${username} -c "${FETCHMAIL} -q &> /dev/null"
                    echo -n " ${username}"
                fi
            done
            echo
            ;;
      restart)
            $0 stop
            $0 start
            ;;
      *)
            echo "Usage: fetchmail {start|stop|restart}"
            exit 1
    esac

    exit 0

    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: steffen.grunewald_at_aei.mpg.de: "Re: fstab not mounting, but command line mount works"

    Relevant Pages

    • RE: configuring dial-up for extreme novices (i.e. Mom).
      ... I'm going to use userland ppp and postfix. ... > your Mom a script to run which will start fetchmail, ... Then have commands in script to kill fetchmail and user ... sudo /usr/sbin/ppp -quiet -background myisp ...
      (freebsd-questions)
    • Re: Troubles starting fetchmail from init scripts
      ... My startup script and configuration. ... # Start fetchmail for jonrysh ... echo "Configuration file not found " ...
      (Fedora)
    • Re: strange email behavior
      ... > different computer you use fetchmail to connect to the ... > poll your POP3 mailbox manually to debug your problem. ... I saw that the script was calling /etc/fetchmailrc, ... instead of my user's mbox. ...
      (RedHat)
    • Re: Fetchmail revisited
      ... > fetchmail supports that. ... a script written by you rather than handing it to the MTA untouched. ... AND I did help the sorting a bit because at my ISP I'm allowed to ...
      (alt.os.linux.suse)
    • Re: strange email behavior
      ... I have mutt set to ... > delete messages older than two weeks in my mailing lists folder, ... startup script for fetchmail that might have something to do with it. ...
      (RedHat)