From aae632220a69c5944afad87ca284b907f8e0178e Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 22 May 2020 00:24:52 +0200
Subject: [PATCH] Fix systemd timers.

---
 .../system/{fetchmail.service => fetchmail_old_account.service} | 0
 .../fetchmail.timer => fetchmail_old_account.timer}             | 2 +-
 .../etc/systemd/system/{timers.target.wants => }/pingmail.timer | 0
 buster/setup_scripts/setup_mail.sh                              | 2 ++
 4 files changed, 3 insertions(+), 1 deletion(-)
 rename buster/etc_files/mail/etc/systemd/system/{fetchmail.service => fetchmail_old_account.service} (100%)
 rename buster/etc_files/mail/etc/systemd/system/{timers.target.wants/fetchmail.timer => fetchmail_old_account.timer} (79%)
 rename buster/etc_files/mail/etc/systemd/system/{timers.target.wants => }/pingmail.timer (100%)

diff --git a/buster/etc_files/mail/etc/systemd/system/fetchmail.service b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.service
similarity index 100%
rename from buster/etc_files/mail/etc/systemd/system/fetchmail.service
rename to buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.service
diff --git a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer
similarity index 79%
rename from buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer
rename to buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer
index c67e8e7..0568eeb 100644
--- a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer
+++ b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer
@@ -2,7 +2,7 @@
 Description=Run fetchmail once every minute
 
 [Timer]
-OnCalendar=*-*-* *:*:00
+OnCalendar=minutely
 
 [Install]
 WantedBy=timers.target
diff --git a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/pingmail.timer b/buster/etc_files/mail/etc/systemd/system/pingmail.timer
similarity index 100%
rename from buster/etc_files/mail/etc/systemd/system/timers.target.wants/pingmail.timer
rename to buster/etc_files/mail/etc/systemd/system/pingmail.timer
diff --git a/buster/setup_scripts/setup_mail.sh b/buster/setup_scripts/setup_mail.sh
index 09ae762..8120017 100755
--- a/buster/setup_scripts/setup_mail.sh
+++ b/buster/setup_scripts/setup_mail.sh
@@ -46,6 +46,8 @@ cp "${config_tree_prefix}/other_files/pingmailrc" /home/plom/.pingmailrc
 chown plom:plom /home/plom/.pingmailrc
 su -lc "cd && git clone https://plomlompom.com/repos/clone/pingmail" plom
 systemctl daemon-reload
+systemctl enable --now fetchmail_old_account.timer
+systemctl enable --now pingmail.timer
 
 # To allow IMAPS access.
 echo "ssl_cert = </etc/letsencrypt/live/$(hostname -f)/fullchain.pem" > /etc/dovecot/conf.d/99-ssl-certs.conf
-- 
2.30.2