PostfixAdmin Fetchmail (Ubuntu 16.04)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Voraussetzungen

Fetchmail muss bereits installiert sein.

Daemon deaktivieren

In der Datei /etc/default/fetchmail folgende Zeile anpassen:

sudo vi /etc/default/fetchmail
START_DAEMON=no

Danach fetchmail stoppen:

sudo /etc/init.d/fetchmail stop

Abhängigkeiten

sudo apt-get update
sudo apt-get install liblockfile-simple-perl

Script fetchmail.pl

Fertiges Script von /<document root>/ADDITIONS/ nach /usr/local/bin/ kopieren:

sudo cp /var/www/postfixadmin/ADDITIONS/fetchmail.pl /usr/local/bin/
sudo chown root:vmail /usr/local/bin/fetchmail.pl
sudo chmod 750 /usr/local/bin/fetchmail.pl

In der Datei fetchmail.pl folgende Werte anpassen:

sudo nano /usr/local/bin/fetchmail.pl
# database backend
$db_type = 'mysql';
# host name
$db_host="<server ip>";
# database name
$db_name="postfix";
# database username
$db_username="postfix";
# database password
$db_password="<password>";

Lock-Datei anlegen

sudo -u vmail mkdir /home/vmail/fetchmail/
sudo -u vmail touch /home/vmail/fetchmail/fetchmail-all.lock
sudo vi /usr/local/bin/fetchmail.pl

Pfad zur Lock-Datei von

$run_dir="/var/run/fetchmail";

nach

$run_dir="/home/vmail/fetchmail";

ändern, da /var/run/ bei jedem Neustart geleert wird.

Cronjob anlegen

sudo crontab -e
*/1 * * * * sudo -H -u vmail /usr/local/bin/fetchmail.pl > /dev/null 2&>1


Zurück zu PostfixAdmin