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 ...
- 01-26-2004 #1Just 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.
- 01-26-2004 #2Linux 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):
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:*/5 * * * * fetchmail -v >/dev/tty7 2>&1
Code:chown user1:tty /dev/tty7
- 01-26-2004 #3Just 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: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?Code:fetchmail -d 300
- 01-27-2004 #4Just 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.
- 01-27-2004 #5Just 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:
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?Code:ln -s /etc/rc.d/init.d/fetchmail /etc/rc.d/rc3.d/S99fetchmail
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
toCode:fetchmail -v
so that it loads the user's configuration file.Code:fetchmail -vf /home/darwin/.fetchmailrc
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
- 01-28-2004 #6Just 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
- 01-28-2004 #7Just Joined!
- Join Date
- Nov 2002
- Location
- USA
- Posts
- 99
Glad to help!


Reply With Quote
