Find the answer to your Linux question:
Results 1 to 7 of 7
I'm running redhat linux for a mail server. I'm using Postfix to send email and fetchmail to fetching mail from my ISP every 5 minutes. In xwindows i'm setting my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2004
    Posts
    8

    fetchmail problemDO you guys


    I'm running redhat linux for a mail server. I'm using Postfix to send email and fetchmail to fetching mail from my ISP every 5 minutes. In xwindows i'm setting my redhat to automatically logon as user1 and put fetchmail to running automatically in startup program (session).
    But now after setting My redhat to boot to text mode, i must manually login as user1 and then type fetchmail -v.
    Do you guys know another ways to run it automatically in text mode?



    TIA,
    Christian.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    The best way as I see it would be to add it to user1's crontab. To do that, log in as user1, run crontab and enter this (type Ctrl+D to stop):
    Code:
    */5 * * * * fetchmail -v >/dev/tty7 2>&1
    That will start fetchmail -v every five minutes and put the output on tty7 (type Alt+F7 to see it). To make that work, though, you have to chown /dev/tty7 to user1 (or user1 won't be able to open it), like this:
    Code:
    chown user1:tty /dev/tty7

  3. #3
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    Another way is to add fetchmail to your system's startup routine. There are two ways to add a process to your startup routine. The preferred method is to add a startup script in your /etc/rc.d/init.d/ directory and then create links for the runlevels that will start the process in the appropriate SysV directories. The other way is to add it to the end of the last script that gets run at startup: /etc/rc.d/rc.local

    You do not absolutely have to run fetchmail in a cron job. Fetchmail has a built in option for restarting at a specified interval. Check out the daemon mode option. The following will restart fetchmail every five minutes:
    Code:
    fetchmail -d 300
    Also, just curious, which version of Redhat Linux are you using? I use Mandrake 8.2 which is very similar to Redhat. Is there a script named fetchmail in your /etc/rc.d/init.d/ directory?

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jan 2004
    Posts
    8
    Dear Dolda200 and slant6

    Thankyou for your help, i'll try it soon. For Slant6, my redhat version 9.0 and there are script named fetchmail in my /etc/rc.d/init.d/ directory. Its contains :

    # description: fetching email from my ISP
    # chkconfig : 2345 99 00

    pidfile: /home/darwin/.fetchmail.pid
    config: /home/darwin/.fetchmailrc

    case "$1" in
    'start')
    fetchmail -v
    touch /var/lock/subsys/fetchmail
    ;;

    'stop')
    fetchmail -g
    rm -f /var/lock/subsys/fetchmail
    ;;

    *)
    echo "usage: $0 { start | stop }"
    ;;

    esac
    exit 0


    Maybe this script created by me using webmin program. Are the script correct? Thankyou


    regards,
    christian.

  6. #5
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    In that case, all you have to do is add a link to the fetchmail script in your directory for run level 3 (console mode startup). Login as root and type the following:
    Code:
    ln -s /etc/rc.d/init.d/fetchmail /etc/rc.d/rc3.d/S99fetchmail
    If you take a look in the /etc/rc.d/rc3.d/ directory you will see that is contains a bunch of soft links. Each one just points to a script in /etc/rc.d/init.d/ Each link starting with the letter 'S' gets started when your system starts up in run level 3. They start in order of the two-digit number after the S. So, S99fetchmail will be one of the last daemons to start up when your system loads. You can change the order of startup just by changing that two digit number obviously. Make sense?

    Now, about your fetchmail script. It appears incomplete to me, but maybe your configuration is set up different than mine since I'm using Mandrake and not Redhat. I agree that is looks like your script was created from some administration tool like webmin.

    If your script doesn't work, you may want to change the line
    Code:
    fetchmail -v
    to
    Code:
    fetchmail -vf /home/darwin/.fetchmailrc
    so that it loads the user's configuration file.

    Also, add this to the first line of your configuration file: .fetchmailrc, so that fetchmail will check for new mail every five minutes:
    Code:
    set daemon 300

  7. #6
    Just Joined!
    Join Date
    Jan 2004
    Posts
    8

    re: fetchmail problem

    Dear Slant6,


    Thankyou verymuch for you help, my fetchmail now work fine. Its load automatically in text mode. I using scripts methods. But I think I'm must learn much about linux OS. Once again thankyou.



    cheers,
    christian

  8. #7
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    Glad to help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •