fetchmail-friends
[Top] [All Lists]

Re: [fetchmail][Q] log files

2004-05-20 04:26:27
On Wed, May 19, 2004 at 11:38:08AM -0700, Sam wrote:


--- Ray Warren <raywarren2(_at_)insightbb(_dot_)com> wrote:
On Wed, May 19, 2004 at 09:37:05AM -0700, Sam wrote:

I checked the FAQ and man page...

Is there a signal I can send to fetchmail to have it close
and reopen its logfile?  (freopen(2))

Why?  If I move "log" to "log.0" and then awake fetchmail it
continues to log to log.0.  How can I get it to log to
"log"?  I don't want to kill the daemon.

This seems like basic daemon/log behavior so I'm surprised 
if I'm the first to ask about it. :-)

I use this script in /etc/logrotate.d/.It restarts the daemon instead 
of just killing it.

I guess I forgot to mention I'm running fetchmail as myself (non-root).

But anyway, killing and starting fetchmail in my case requires me to
enter my password.  I don't want to put my passwd in .fetchmailrc.  Thus the
reason not to restart fetchmail.

What does /etc/rc.d/init.d/fetchmail contain?

#!/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
                gprintf "Starting Fetchmail services: "
                daemon fetchmail  -d 600 -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
        gprintf "Reloading fetchmailrc file: "
                killproc fetchmail -HUP
                RETVAL=$?
                echo
        else
                RETVAL=1
        fi
        ;;
  status)
        status fetchmail
        RETVAL=$?
        ;;
  *)
        gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
        exit 1
esac

exit $RETVAL



I am running fetchmail as a daemon & do have my email passwords in
fetcmailrc.I collect mail for three different email accounts and none of
the email addresses or passwords correspond to my user name or password
on any shell login so its not a security problem for me.Additionally the
permissions on the file are set so the only people who can read it are
 myself & root.
 Ray Warren


<Prev in Thread] Current Thread [Next in Thread>