From: Christian Heller Date: Thu, 21 May 2020 22:24:52 +0000 (+0200) Subject: Fix systemd timers. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/day?a=commitdiff_plain;h=aae632220a69c5944afad87ca284b907f8e0178e;p=config Fix systemd timers. --- diff --git a/buster/etc_files/mail/etc/systemd/system/fetchmail.service b/buster/etc_files/mail/etc/systemd/system/fetchmail.service deleted file mode 100644 index dc8acb4..0000000 --- a/buster/etc_files/mail/etc/systemd/system/fetchmail.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Run plom's fetchmail - -[Service] -Type=oneshot -User=plom -# fetchmail returns 1 when no new mail, we want to catch that -ExecStart=/bin/sh -c 'fetchmail || [ $? -eq 1 ]' diff --git a/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.service b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.service new file mode 100644 index 0000000..dc8acb4 --- /dev/null +++ b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.service @@ -0,0 +1,8 @@ +[Unit] +Description=Run plom's fetchmail + +[Service] +Type=oneshot +User=plom +# fetchmail returns 1 when no new mail, we want to catch that +ExecStart=/bin/sh -c 'fetchmail || [ $? -eq 1 ]' diff --git a/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer new file mode 100644 index 0000000..0568eeb --- /dev/null +++ b/buster/etc_files/mail/etc/systemd/system/fetchmail_old_account.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run fetchmail once every minute + +[Timer] +OnCalendar=minutely + +[Install] +WantedBy=timers.target diff --git a/buster/etc_files/mail/etc/systemd/system/pingmail.timer b/buster/etc_files/mail/etc/systemd/system/pingmail.timer new file mode 100644 index 0000000..dba0c9f --- /dev/null +++ b/buster/etc_files/mail/etc/systemd/system/pingmail.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run pingmail check once every hour + +[Timer] +OnCalendar=*-*-* *:00:00 + +[Install] +WantedBy=timers.target diff --git a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer b/buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer deleted file mode 100644 index c67e8e7..0000000 --- a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/fetchmail.timer +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Run fetchmail once every minute - -[Timer] -OnCalendar=*-*-* *:*:00 - -[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/timers.target.wants/pingmail.timer deleted file mode 100644 index dba0c9f..0000000 --- a/buster/etc_files/mail/etc/systemd/system/timers.target.wants/pingmail.timer +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Run pingmail check once every hour - -[Timer] -OnCalendar=*-*-* *:00:00 - -[Install] -WantedBy=timers.target 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/dovecot/conf.d/99-ssl-certs.conf