Hello,
i have problems with the automatic start of Fetchmail.
I only have a small mail environment here and I want to save the money for a bigger contract. I cannot change DNS entries in my domain contract.
I am actually 100% a Windows Admin and therefore I know very little about Linux. Please excuse that I don't know much about Linux.
The basic installation of Fetchmail works by manual retrieval and the further processing of the mails by EFA works.
fetchmail -v -a -k -f /etc/fetchmailrc -> works fine.
What unfortunately doesn't work is the setup as a service.
This manual here is based on Centos 6 and hopefully contains all points.
https://www.gtkdb.de/index_33_1367.html
The service is also started... but I don't receive any messages and a /var/log/fetchmail file is not created.
I hope someone has a tip for me!
In which file can I see where the problem is?
Translated with www.DeepL.com/Translator (free version)
Install Fetchmail as a Service
Re: Install Fetchmail as a Service
Dont know about the service or how to do that on Centos 7/8
You can run fetchmail as a cronjob for the fetchmail user. (as fetchmail should not run as root)
I dont like fetchmailrc in /etc. I would move it to the fetchmailrc home dir
So create or move the fetchmailrc in/to the home dir of the fetchmail user
You can then create the cronjob to exec every x min to exec fetchmail.
Or create a small script to manage this ( in this example every 5 min)
!!! to edit the fetchmailrc file: su fetchmail
====Script==== /home/fetchmail/fetch-mail.sh
When you got this working feel free to PM me for some additional fetchmailrc settings to make fetchmail secure.( using ssl / sslcertck)
to explain --invisible (ensures the correct IP in Received from Header) viewtopic.php?t=2545
To search fetchmail on efa, google :
You can run fetchmail as a cronjob for the fetchmail user. (as fetchmail should not run as root)
I dont like fetchmailrc in /etc. I would move it to the fetchmailrc home dir
So create or move the fetchmailrc in/to the home dir of the fetchmail user
You can then create the cronjob to exec every x min to exec fetchmail.
Or create a small script to manage this ( in this example every 5 min)
!!! to edit the fetchmailrc file: su fetchmail
Code: Select all
*/5 * * * * /home/fetchmail/fetch-mail.sh >> /var/log/fetchmail/fetchmail.log 2>&1
Code: Select all
#!/bin/bash
if [ -f /home/fetchmail/red.flg ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! RED Flag deteced; not proceding !"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 99
fi
touch /home/fetchmail/red.flg
fetchmail --nokeep --invisible -a
rm -f /home/fetchmail/red.flg
to explain --invisible (ensures the correct IP in Received from Header) viewtopic.php?t=2545
To search fetchmail on efa, google :
Code: Select all
site:forum.efa-project.org fetchmail
“We are stuck with technology when what we really want is just stuff that works.” -Douglas Adams
Re: Install Fetchmail as a Service
Hello and thank you for your answer.
I have created the user Fetchmail:
useradd fetchmail
After that I loggend with su fetchmail to create the files.
I created the fetchmailrc and the fetch-mail.sh files with the pop3 data in /home/fetchmail
When I execute the */5 * * * *..... line as fetchmail it tells me that /var/log/fetchmail/fetchmail.log is not a file or directory.
I shortened the /var/log/ path to /var/log/fetchmail.log once, but then I get a permission denied
As mentioned... I am really not a Linux expert... ask me about Windows... here I can help.
Thanks for your support!
Translated with www.DeepL.com/Translator (free version)
I have created the user Fetchmail:
useradd fetchmail
After that I loggend with su fetchmail to create the files.
I created the fetchmailrc and the fetch-mail.sh files with the pop3 data in /home/fetchmail
When I execute the */5 * * * *..... line as fetchmail it tells me that /var/log/fetchmail/fetchmail.log is not a file or directory.
I shortened the /var/log/ path to /var/log/fetchmail.log once, but then I get a permission denied
As mentioned... I am really not a Linux expert... ask me about Windows... here I can help.
Thanks for your support!
Translated with www.DeepL.com/Translator (free version)
Re: Install Fetchmail as a Service
when loggedin, on the cmd line
Check cron service is running
change to user fetchmail
as user fetchmail
and paste the line mentioned before.
to save enter in this sequence: Esc :wq
https://ryanstutorials.net/linuxtutoria ... heetvi.php
Check cron service is running
Code: Select all
systemctl status crond
Code: Select all
su fetchmail
Code: Select all
crontab -e
to save enter in this sequence: Esc :wq
https://ryanstutorials.net/linuxtutoria ... heetvi.php
“We are stuck with technology when what we really want is just stuff that works.” -Douglas Adams
Re: Install Fetchmail as a Service
Hello Henk,
thank you very much for your answer.
I was able to solve the problem as follows.
I created a fetchmail user and configured fetchmail with it in daemon mode.
Is there anything against using fetchmail in the context of a user?
The instructions would like to work without a login.
This is actually quite simple if you know a little about Linux.
Here it worked and I am satisfied for now.
thank you very much for your answer.
I was able to solve the problem as follows.
I created a fetchmail user and configured fetchmail with it in daemon mode.
Is there anything against using fetchmail in the context of a user?
The instructions would like to work without a login.
This is actually quite simple if you know a little about Linux.
Here it worked and I am satisfied for now.